kaball Posted June 9, 2009 Posted June 9, 2009 Hello to all. I was wondering if someone could help me in this, I am trying to list the job of an user in the viewuser.php by adding a new row corresponding to the wright variable, and i use this code: Money: \${$r['money']} Crystals: {$r['crystals']} Job: {$ir['jrNAME']} It doesen`t give any errors and not even shows the information required, Anny suggestions ? I just want the users see the jobs that players have, Quote
AbsentCrisis Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php change this "Job: {$ir['jrNAME']} " to "Job: {$r['jrNAME']} " - I think this should fix, bare om mind never worked with mcc. Quote
wolfe Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php You have to do the query to select the jobname that is associated with the job field in the user table. Quote
AbsentCrisis Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php But isnt using "$r" selecting all that from the global file if im not mistaken.. Quote
wolfe Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php No. $ir will select job info in the global query if $jobquery is triggered. (should be standard mccodes v2). However if you want the jobname to show up you have to either select it or add it to the selct statement that is already pulling users, gangs, and house info (viewuser.php). Quote
CrazyT Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php Some of ya's need to learn lol. Open viewuser.php Find on the query: u.*,us.*,c.*,h.*,g.*,f.* After add: ,j.`jNAME` AS `job` So it becomes like: u.*,us.*,c.*,h.*,g.*,f.*,j.`jNAME` AS `job` Then find in the query or something like this: LEFT JOIN `fedjail` f ON (f.`fed_userid` = u.`userid`) After add: LEFT JOIN `jobs` AS `j` ON(j.`jID` = u.`job`) Then just add some were on your page: Job: {$r['job']} Your done. Or from the first thing i said: ,j.`jNAME` AS `job` You can remove AS `job` Then use: Job: {$r['jNAME']} Hope it helps... Quote
kaball Posted June 10, 2009 Author Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php It helps but... the full correct code is this: $q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.*,j.`jNAME` AS `job` FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN cities c ON u.location=c.cityid LEFT JOIN houses h ON u.maxwill=h.hWILL LEFT JOIN gangs g ON g.gangID=u.gang LEFT JOIN fedjail f ON f.fed_userid=u.userid LEFT JOIN jobs AS j ON j.jID=u.job WHERE u.userid={$_GET['u']}"); if($db->num_rows($q) == 0) Until now it works perfectly This code shows the job type, i wonder if there can be added a comma (symbol ",") or another row and add a variable for the job rank (important to the employers in the same job type)... Quote
CrazyT Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php It helps but... the full correct code is this: $q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.*,j.`jNAME` AS `job` FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN cities c ON u.location=c.cityid LEFT JOIN houses h ON u.maxwill=h.hWILL LEFT JOIN gangs g ON g.gangID=u.gang LEFT JOIN fedjail f ON f.fed_userid=u.userid LEFT JOIN jobs AS j ON j.jID=u.job WHERE u.userid={$_GET['u']}"); if($db->num_rows($q) == 0) Until now it works perfectly This code shows the job type, i wonder if there can be added a comma (symbol ",") or another row and add a variable for the job rank (important to the employers in the same job type)... The one i posted worked.. Quote
kaball Posted June 10, 2009 Author Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php CrazyT, yes it works... it shows the job type, it is great, but i was sayng that if there could be another command line that shows the job rank :-D The code i`ve posted earlyer is the code from my viewuser.php adapted with your variable command and i works perfectly, Thanks. Quote
CrazyT Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php CrazyT, yes it works... it shows the job type, it is great, but i was sayng that if there could be another command line that shows the job rank :-D The code i`ve posted earlyer is the code from my viewuser.php adapted with your variable command and i works perfectly, Thanks. $db->query( "SELECT u.*,us.*,c.*,h.*,g.*,f.*,j.`jNAME` AS `job`, jr.`jrNAME` AS `job_rank_name` ". "FROM `users` AS `u` ". "LEFT JOIN `userstats` AS `us` ON (u.`userid` = us.`userid`) ". "LEFT JOIN `cities` AS `c` ON (u.`location` = c.`cityid`) ". "LEFT JOIN `houses` AS `h` ON (u.`maxwill` = h.`hWILL`) ". "LEFT JOIN `gangs` AS `g` ON (g.`gangID` = u.`gang`) ". "LEFT JOIN `fedjail` AS `f` ON (f.`fed_userid` = u.`userid`) ". "LEFT JOIN `jobs` AS `j` ON(j.`jID` = u.`job`) ". "LEFT JOIN `jobranks` AS `jr` ON(j.`jFIRST` = jr.`jrID`) ". "WHERE ((j.`jID` = u.`job`) && (u.`userid` = '{$_GET['u']}'))"); With job name and job rank. to show job rank you will do: echo $r['job_rank_name']; To show there job. echo $r['job']; Whats so hard about it? Quote
CrazyT Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a3720198/public_html/viewuser.php on line 101 refes to echo $r['job_rank_name']; and echo $r['job']; so is nor working ... rhe first code you`ve suplied was god tge second one doesnt :( You mailed me when you could of posted it here. Because.. you need to add it before you stop the print statement.. or you have added it inside it :D Quote
kaball Posted June 10, 2009 Author Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a3720198/public_html/viewuser.php on line 101 refes to echo $r['job_rank_name']; and echo $r['job']; so is nor working ... rhe first code you`ve suplied was god tge second one doesnt :( You mailed me when you could of posted it here. Because.. you need to add it before you stop the print statement.. or you have added it inside it :D Yes i`ve prefered private message instead making useless posts and in the end just topic the solution... (with all your credits) What you mean "you need to add it before you stop the print statement..." An example would be good... please be more specific Quote
CrazyT Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php You could of done this: print "Username: {$r['username']} Userid: {$r['userid']} Job: {$r['job']} echo "Job Rank: {$r['job_rank_name']}"; If you can't find the error pm me, your viewuser.php or post it here. Quote
wolfe Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php kabal you may want to read up on basic use of mysql and php. Quote
wolfe Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Job display in viewuser.php And crazyt i didnt want to just hand him the code since its just basic use of queries and such. He should take a bit of time and read up and at least learn the basics. Quote
kaball Posted June 11, 2009 Author Posted June 11, 2009 Re: [MCCODES v2] Job display in viewuser.php Now i understand why the topics are dieing on this forum... people just giving "advices" instead helping, and there are not solved in the manner that they should (by cooperating and/or giving a hand with a real solution) I supposed the meaning of a forum was to help each other, not rejecting the request of a new user, because if you see that i have few posts on this forum and i was not requesting the moon. Thank you for your kindness wolfe, i will read and learn the php and the mysql, till then ... keep up the "god work" you are doing (double posting and giving advices) Quote
Miniman Posted June 11, 2009 Posted June 11, 2009 Re: [MCCODES v2] Job display in viewuser.php Now i understand why the topics are dieing on this forum... people just giving "advices" instead helping, and there are not solved in the manner that they should (by cooperating and/or giving a hand with a real solution) I supposed the meaning of a forum was to help each other, not rejecting the request of a new user, because if you see that i have few posts on this forum and i was not requesting the moon. Thank you for your kindness wolfe, i will read and learn the php and the mysql, till then ... keep up the "god work" you are doing (double posting and giving advices) I think you've completely miss-understood. It's not that people of CE don't want to give you help....You don't know a thing about what your doing or where you plan to go with it. You don't know the basics of HTML, PHP, Mysql and whatever, yet still, you jumped straight into a game for some cash. Then when your game fails, you'll come back here asking for help. I guess people are just used to this :wink: Quote
CrazyT Posted June 11, 2009 Posted June 11, 2009 Re: [MCCODES v2] Job display in viewuser.php Now i understand why the topics are dieing on this forum... people just giving "advices" instead helping, and there are not solved in the manner that they should (by cooperating and/or giving a hand with a real solution) I supposed the meaning of a forum was to help each other, not rejecting the request of a new user, because if you see that i have few posts on this forum and i was not requesting the moon. Thank you for your kindness wolfe, i will read and learn the php and the mysql, till then ... keep up the "god work" you are doing (double posting and giving advices) I think you've completely miss-understood. It's not that people of CE don't want to give you help....You don't know a thing about what your doing or where you plan to go with it. You don't know the basics of HTML, PHP, Mysql and whatever, yet still, you jumped straight into a game for some cash. Then when your game fails, you'll come back here asking for help. I guess people are just used to this :wink: I think everyone, doe's lol.. Put a game up just to take the money when the game die's they sell it make a new one do the same thing over and over again. Quote
kaball Posted June 11, 2009 Author Posted June 11, 2009 Re: [MCCODES v2] Job display in viewuser.php I think you've completely miss-understood. It's not that people of CE don't want to give you help....You don't know a thing about what your doing or where you plan to go with it. You don't know the basics of HTML, PHP, Mysql and whatever, yet still, you jumped straight into a game for some cash. Then when your game fails, you'll come back here asking for help. I guess people are just used to this :wink: First of all :-D the game is purchased, working on a server that is at my workplace... All of my colleagues are playing this mmorpg and the game is online too... Secondly the game that i administrate is not for reselling is just for developing and make updates to it. :-D Thirdly the game didn`t fail and i don`t ask for help on this forums just because i don`t know "how to", (i`ve just need a little help on that variable) The Job rank is not displayed well because is running "LEFT JOIN `jobranks` AS `jr` ON(j.`jFIRST` = jr.`jrID`) ". Witch you all know is showing the first rank job from the job type... I`m not arguing with you all on nothing... i was just asking a help in oder to avoid the script being ruined. Regards to all, Quote
wolfe Posted June 11, 2009 Posted June 11, 2009 Re: [MCCODES v2] Job display in viewuser.php Now i understand why the topics are dieing on this forum... people just giving "advices" instead helping, and there are not solved in the manner that they should (by cooperating and/or giving a hand with a real solution) I supposed the meaning of a forum was to help each other, not rejecting the request of a new user, because if you see that i have few posts on this forum and i was not requesting the moon. Thank you for your kindness wolfe, i will read and learn the php and the mysql, till then ... keep up the "god work" you are doing (double posting and giving advices) I think you've completely miss-understood. It's not that people of CE don't want to give you help....You don't know a thing about what your doing or where you plan to go with it. You don't know the basics of HTML, PHP, Mysql and whatever, yet still, you jumped straight into a game for some cash. Then when your game fails, you'll come back here asking for help. I guess people are just used to this :wink: Completely agree with this assessment. Quote
wolfe Posted June 11, 2009 Posted June 11, 2009 Re: [MCCODES v2] Job display in viewuser.php I think you've completely miss-understood. It's not that people of CE don't want to give you help....You don't know a thing about what your doing or where you plan to go with it. You don't know the basics of HTML, PHP, Mysql and whatever, yet still, you jumped straight into a game for some cash. Then when your game fails, you'll come back here asking for help. I guess people are just used to this :wink: First of all :-D the game is purchased, working on a server that is at my workplace... All of my colleagues are playing this mmorpg and the game is online too... Secondly the game that i administrate is not for reselling is just for developing and make updates to it. :-D Thirdly the game didn`t fail and i don`t ask for help on this forums just because i don`t know "how to", (i`ve just need a little help on that variable) The Job rank is not displayed well because is running "LEFT JOIN `jobranks` AS `jr` ON(j.`jFIRST` = jr.`jrID`) ". Witch you all know is showing the first rank job from the job type... I`m not arguing with you all on nothing... i was just asking a help in oder to avoid the script being ruined. Regards to all, The point i have is that if you are going to run a game and make code changes its useful to know the basics of how to code. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.