Nicholas Posted December 17, 2009 Posted December 17, 2009 ok im having little trouble with adding something on viewuser... i added $m=$db->query("SELECT * FROM users WHERE userid='{$r['married']}'"); $par=$db->fetch_row($m); if($ir['married'] != 0) { $partner= "[url='viewuser.php?u={$par[']<font color=yellow>{$par['username']}</font>[/url]"; } else { $partner= "<font color=red>N/A</font>"; } under if($r['donatordays']) { $r['username'] = "<font color=gold>{$r['username']}</font>";$d="[img=donator.gif]"; } then i added this <td> [b]<center>Married:[/b] $partner </td></tr>"; ("; is there because its at the bottom of the list, doesnt make any errors on my game) anyways.... i put it under <tr> <td> [b]Crystals:[/b] {$r['crystals']} </td></tr><tr> it shows the people the 2 players are married to but... if i go on someone profile that isnt married it doesnt say Married: N/A anyone know why? hope you understand everything i just said in this post lol. Quote
Mcfarlin Posted December 17, 2009 Posted December 17, 2009 you might try this [mysql]if($ir['married'] > 0) { print "<a href='viewuser.php?u={$par['userid']}'><font color=yellow> {$par['username']}</font></a>"; } else if($ir['married'] == 0) { print "<font color=red>N/A</font>"; }[/mysql] where you have [mysql]<td> <center>Married: $partner </td></tr>"; [/mysql] Quote
Nicholas Posted December 17, 2009 Author Posted December 17, 2009 that didnt work, thx for trying to help tho :) i also changed that line i done to $m=$db->query("SELECT * FROM users WHERE userid='{$r['married']}'"); $par=$db->fetch_row($m); if($ir['married'] != 0) { $partner= "[url='viewuser.php?u={$par[']<font color=yellow>{$par['username']}</font>[/url]"; } else if($ir['married'] == 0) { $partner= "<font color=red>N/A</font>"; } but that didnt work nether... i guess its probably just my game... Quote
Zero-Affect Posted December 17, 2009 Posted December 17, 2009 SELECT * FROM should be SELECT `userid`, `username` FROM try not to use * basically pulls the entire table which with users is alot of columns Quote
Nicholas Posted December 17, 2009 Author Posted December 17, 2009 i see... but is there any chance you know why its not showing N/A on viewuser? Quote
Zero-Affect Posted December 17, 2009 Posted December 17, 2009 $married_text = (!$ir['married']) ? "<font color=red>N/A</font>" : "[url='viewuser.php?u={$par[']<font color=yellow>{$par['username']} </font>[/url]" ; echo $married_text; is a solution (not tested) Quote
Zero-Affect Posted December 18, 2009 Posted December 18, 2009 Would love to know if it helped... Quote
Nicholas Posted December 18, 2009 Author Posted December 18, 2009 sorry wasnt at pc for few hours, and it didnt work. :( Quote
Mcfarlin Posted December 18, 2009 Posted December 18, 2009 friggen flight delayed again. lol stuck in another airport but i cant see why [mysql]$m=$db->query("SELECT FROM users WHERE userid='{$r['married']}'"); $par=$db->fetch_row($m); if($ir['married'] > 0) { print "<a href='viewuser.php?u={$par['userid']}'><font color=yellow> {$par['username']}</font></a>"; } else if($ir['married'] == 0) { print "<font color=red>single and looking for some action</font>"; } [/mysql] is not working for ya bro. not 100% on the query to pull the info, but the last bit should show what your after. Quote
Zero-Affect Posted December 18, 2009 Posted December 18, 2009 $m = $db->query("SELECT `userid`, `username` FROM `users` WHERE `userid` = '{$r['married']}'"); $par = $db->fetch_row($m); $married_text = ($ir['married'] != "0") ? "<font color=red>N/A</font>" : "[url='viewuser.php?u={$par[']<font color=yellow>{$par['username']} </font>[/url]" ; echo $married_text; i don't see a single issue with that, is there? Quote
Nicholas Posted December 18, 2009 Author Posted December 18, 2009 yes because im checking my profile lol. Quote
Nicholas Posted December 18, 2009 Author Posted December 18, 2009 i think i got it now... if($r['donatordays']) { $r['username'] = "<font color=gold>{$r['username']}</font>";$d="[img=donator.gif]"; } $m=$db->query("SELECT * FROM users WHERE userid='{$r['married']}'"); $par=$db->fetch_row($m); if($r['married'] > 0) { $partner = "<a href='viewuser.php?u={$par['userid']}'><font color=yellow> {$par['username']}</font></a>"; } else if($r['married'] == 0) { $partner = "<font color=red>Nope</font>"; } then i put [b]<center>Married:[/b] $partner where i wanted the text to appear. the way i fixed it was by changing... print " into $partner = " if($ir['married'] > 0) into if($r['married'] > 0) else if($ir['married'] into else if($r['married'] on your first function you done Mcfarlin. :) Quote
Nicholas Posted December 18, 2009 Author Posted December 18, 2009 $m = $db->query("SELECT `userid`, `username` FROM `users` WHERE `userid` = '{$r['married']}'"); $par = $db->fetch_row($m); $married_text = ($ir['married'] != "0") ? "<font color=red>N/A</font>" : "[url='viewuser.php?u={$par[']<font color=yellow>{$par['username']} </font>[/url]" ; echo $married_text; i don't see a single issue with that, is there? i think that would of worked if you had a sprintf fully modified viewuser but mine doesnt have any sprintf stuff in it. due to well idk how to code in that yet lol. as when i tried that... i got an error about a t-string on line $married_text = ($ir['married'] != "0") so i changed it into $married_text = ($ir['married'] != '0') but then i got another error lol. Quote
Zero-Affect Posted December 18, 2009 Posted December 18, 2009 $married_text = ($ir['married'] != "0") so i changed it into $married_text = ($ir['married'] != '0') i didn't say do that did i? $m = $db->query("SELECT `userid`, `username` FROM `users` WHERE `userid` = '{$r['married']}'"); $par = $db->fetch_row($m); $married_text = ($ir['married'] == "0") ? "<font color='red'>N/A</font>" : "[url='viewuser.php?u={$par[']<font color='green'>{$par['username']} </font>[/url]" ; echo "Married: {$married_text}"; Sorry about that noticed a issue Quote
Nicholas Posted December 19, 2009 Author Posted December 19, 2009 no you didnt tell me to do that, but that was the problem i had because of them two " " i got an error but after that i got another error. lol. but its all fixed now finally :) Quote
Zero-Affect Posted December 19, 2009 Posted December 19, 2009 www.criminals-nightmare.co.uk/ nice theme... hint hint Quote
Nicholas Posted December 19, 2009 Author Posted December 19, 2009 www.criminals-nightmare.co.uk/ nice theme... hint hint lol... happy? Quote
Zero-Affect Posted December 19, 2009 Posted December 19, 2009 www.criminals-nightmare.co.uk/ nice theme... hint hint lol... happy? very now just edit the register and ill be ecstatic lol 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.