peterisgb Posted January 3, 2012 Posted January 3, 2012 hello, I got this problem. i've added in a little mod i made which shows the user id last win and last lost. It displays the users ID but idealy i want it to show the players username instead, how do i go about doing this, Here is what i have to this might help put me in the right direction. Last Win: ID <a href='viewuser.php?u={$r['lastwin']}'><font color='green'>{$r['lastwin']}</font><br /></a> Last Lost: ID <a href='viewuser.php?u={$r['lastlost']}'><font color='red'>{$r['lastlost']}</font><br /></a> Quote
peterisgb Posted January 3, 2012 Author Posted January 3, 2012 i've updated this abit $win= "{$r['lastwin']}"; $lost= "{$r['lastlost']}"; Last Win: ID <a href='viewuser.php?u={$r['lastwin']}'><font color='green'><b>$win</b></font><br /></a> Last Lost: ID <a href='viewuser.php?u={$r['lastlost']}'><font color='red'><b>$lost</b></font><br /></a> so anyhelp on displaying username? Quote
Danny696 Posted January 3, 2012 Posted January 3, 2012 Just select it from the user table; $win = @mysql_result($db->query("SELECT `username` FROM `users` WHERE (`userid` = " . $r['lastwin']. ");"),0,0); and edit for the lost. Quote
peterisgb Posted January 3, 2012 Author Posted January 3, 2012 idea, this workd but now doing this affects the links, What shall i do about that. When placing mouse over the username it shows up the correct userid in the viewuser link but when you click this error comes up QUERY ERROR: Unknown column 'N' in 'where clause' Query was SELECT `username` FROM `users` WHERE (`userid` = N/A); how would i go about solving this new problem. Quote
peterisgb Posted January 7, 2012 Author Posted January 7, 2012 this is still an issue can anyone help? Quote
peterisgb Posted January 7, 2012 Author Posted January 7, 2012 i'm not saying that this mod dont work, yet it doeswork but when a user clicks on the username it dont work Quote
Uridium Posted January 8, 2012 Posted January 8, 2012 Peter you will need too show us some lines of how users are called for and if its a fetch_array Quote
peterisgb Posted January 8, 2012 Author Posted January 8, 2012 well in the attack php, a sql update is sent to the users, lastwon and last lost in profile it displays like this Last Win: {$r['lastwon']} <br /> Last Lost: {$r['lastlost']} <br /> What is inserted into the database is the id of the user. which is working good. Quote
Uridium Posted January 8, 2012 Posted January 8, 2012 ok look at the SQL that grabs the select and if its a JOIN ask it to grab username aswell Quote
peterisgb Posted January 9, 2012 Author Posted January 9, 2012 i dont quite get what you mean there illusions, still an amature at the moment, still learning as of yet 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.