kaine- Posted January 4, 2010 Posted January 4, 2010 this is the script i am using:: <?php include "globals.php"; $_GET['u'] = abs((int) $_GET['u']); if(!$_GET['u']) { print "Invalid use of file"; } else { $q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.* 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 WHERE u.userid={$_GET['u']}"); if($db->num_rows($q) == 0) { print "Sorry, we could not find a user with that ID, check your source."; } else { $r=$db->fetch_row($q); $m=$db->query("SELECT * FROM users WHERE userid={$r['married']}"); $par=$db->fetch_row($m); if($r['user_level'] == 1) { $userl="Member"; } else if($r['user_level'] == 2) { $userl="Admin"; } else if ($r['user_level'] == 3) { $userl="Secretary"; } else if($r['user_level'] == 0) { $userl="NPC"; } else {$userl="Assistant"; } $lon=($r['laston'] > 0) ?date('F j, Y g:i:s a',$r['laston']) : "Never"; $sup=date('F j, Y g:i:s a',$r['signedup']); $ts=$r['strength']+$r['agility']+$r['guard']+$r['labour']+$r['IQ']; $d=""; if($r['laston'] > 0) { $la=time()-$r['laston']; $unit="seconds"; if($la >= 60) { $la=(int) ($la/60); $unit="minutes"; } if($la >= 60) { $la=(int) ($la/60); $unit="hours"; if($la >= 24) { $la=(int) ($la/24); $unit="days"; } } $str="$la $unit ago"; } else { $str="--"; } if($r['last_login'] > 0) { $ll=time()-$r['last_login']; $unit2="seconds"; if($ll >= 60) { $ll=(int) ($ll/60); $unit2="minutes"; } if($ll >= 60) { $ll=(int) ($ll/60); $unit2="hours"; if($ll >= 24) { $ll=(int) ($ll/24); $unit2="days"; } } $str2="$ll $unit2 ago"; } else { $str2="--"; } if($r['married'] != 0) { $partner= "<font color=green>{$par['username']}</font>"; } else { $partner= "<font color=red>N/A</font>"; } if($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>";$d=""; } if($r['laston'] >= time()-15*60) { $on="<font color=green>Online</font>"; } else { $on="<font color=red>Offline</font>"; } print "<h3>Profile for {$r['username']}</h3> <table width=95% cellspacing=1 class='table'><tr> <th align='left'>User Infomation</th> <th width='25%'>Display Picture</th></tr> <tr><td> Name: {$r['username']} [{$r['userid']}] $d Online: $on User Level: $userl Duties: {$r['duties']} Gender: {$r['gender']} Days Old: {$r['daysold']} Level: {$r['level']} Gang: "; if($r['gang']) { print "{$r['gangNAME']}"; } else { print "N/A"; } print " Property: {$r['hNAME']} Health: {$r['hp']}/{$r['maxhp']} Married: $partner Friends: {$r['friend_count']} Enemies: {$r['enemy_count']} Signed Up: $sup Last Active: $lon Last Action: $str Last Login: $str2 Location: {$r['cityname']} Referals: "; $rr=$db->query("SELECT * FROM referals WHERE refREFER={$r['userid']}"); print $db->num_rows($rr); print ""; if($r['fedjail']) { print " <font color=red>In federal jail for {$r['fed_days']} day(s). {$r['fed_reason']}</font>"; } if($r['hospital']) { print " <font color=red>In hospital for {$r['hospital']} minutes. {$r['hospreason']}</font>"; } if($r['jail']) { print " <font color=red>In jail for {$r['jail']} minutes. {$r['jail_reason']}</font>"; } print "</td> <td align='center'>"; if($r['display_pic']) { print ""; } else { print "This user has no display pic!"; } $sh=($ir['user_level'] >1) ? "Staff Info" : ""; print "</td></tr> <tr> <td width='25%' align='center'> </td> <td colspan='3' align='center'>User Interaction Links</td> </tr> <tr> <td width='25%' align='left' valign='top'>"; $pd=$db->query("SELECT * FROM pdetails WHERE userid={$r['userid']}"); $p=$db->fetch_row($pd); echo "<u>Personal Information:</u> "; if($p['personal']=='ON') { echo "First Name: {$p['first']} Last Name: {$p['last']} Age: {$p['age']} Aim Of The Game: {$p['aog']} Msn: {$p['msn']} Aim: {$p['aim']} Aol: {$p['aol']} Yahoo: {$p['yahoo']} "; } else { echo "This person dose not wont to share there personal details."; } print " </td> <td colspan='3' align='center'> [Send Mail] [Display Cabinet] [Send Cash] "; if($set['sendcrys_on']) { print "[Send Crystals] "; } if($set['sendbank_on']) { if($ir['bankmoney'] >= 0 && $r['bankmoney'] >= 0) { print "[Bank Transfer] "; } } print " [Attack]"; if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5) { print " [Jail] [MailBan]"; } if($ir['donatordays'] > 0) { print " [Add Friends] [Add Enemies] "; } print "</td> </tr> <tr> <td colspan='4' align='center'>$sh</td> </tr> <tr> <td colspan='4' align='center'>"; if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5) { $r['lastiph']=@gethostbyaddr($r['lastip']); $r['lastiph']=checkblank($r['lastiph']); $r['lastip_loginh']=@gethostbyaddr($r['lastip_login']); $r['lastip_loginh']=checkblank($r['lastip_loginh']); $r['lastip_signuph']=@gethostbyaddr($r['lastip_signup']); $r['lastip_signuph']=checkblank($r['lastip_signuph']); print "<h3>Internet Info</h3><table width='100%' border='0' cellspacing='1' class='table'> <tr><td align='center'></td><td align='center' class='h'>IP</td><td align='center' class='h'>Hostname</td></tr> <tr><td align='center' class='h'>Last Hit</td><td align='center'>$r[lastip]</td><td align='center'>$r[lastiph]</td></tr> <tr><td align='center' class='h'>Last Login</td><td align='center'>$r[lastip_login]</td><td align='center'>$r[lastip_loginh]</td></tr> <tr><td align='center' class='h'>Signup</td><td align='center'>$r[lastip_signup]</td><td align='center'>$r[lastip_signuph]</td></tr></table>"; print "<form action='staffnotes.php' method='post'> Staff Notes: <textarea rows=7 cols=60 name='staffnotes'>{$r['staffnotes']}</textarea> <input type='hidden' name='ID' value='{$_GET['u']}' /> <input type='submit' value='Change' /></form>"; } else { print ""; } print "</tr></table>"; } } function checkblank($in) { if(!$in) { return "N/A"; } return $in; } if($r['profileSIG'] == "") { print " <table cellspacing=1 class='table' width='95%'> <tr style='background:black'> <th><center>Profile Signature</center></th> </tr> <tr> <td><center>This user has not got a profile signature!</center></td> </tr> </table>"; } else { print " <table cellspacing=1 class='table' width='95%'> <tr style='background:black'> <th><center>Profile Signature</center></th> </tr> <tr> <td>{$r['profileSIG']}</td> </tr> </table>"; } $h->endpage(); ?> but when i put it on it says this: QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Query was SELECT * FROM users WHERE userid= can someone help me? Quote
Eruondo Posted January 4, 2010 Posted January 4, 2010 $m=$db->query("SELECT * FROM users WHERE userid={$r['married']}"); I think that would be where the error lies. Is $r['married'] set? Quote
Zero-Affect Posted January 4, 2010 Posted January 4, 2010 does the married column have content or exist? 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.