SirChick Posted December 17, 2007 Share Posted December 17, 2007 I have a query that wont call up the username even tho the username is spelt case accurate... is my syntax wrong? $ReportedPlayer = 1; $GetUserName = mysql_query("SELECT Username FROM userregistration WHERE UserID='$ReportedPlayer'") or die(mysql_error()); $UserNameRow = mysql_fetch_assoc($GetUserName); $ReportedPlayer = $UserNameRow['Username']; Quote Link to comment Share on other sites More sharing options...
kts Posted December 17, 2007 Share Posted December 17, 2007 Just to help you along with debugging, I'd suggest you figure this one out by echoing out your variables and seeing what they contain. That should be able to answer your question. Quote Link to comment Share on other sites More sharing options...
craygo Posted December 17, 2007 Share Posted December 17, 2007 Yes, you should also break things up so that you can debug when needed <?php $ReportedPlayer = 1; $sql = "SELECT Username FROM userregistration WHERE UserID='$ReportedPlayer'"; echo $sql; // Will echo what will be passed to mysql $GetUserName = mysql_query($sql) or die(mysql_error()); $UserNameRow = mysql_fetch_assoc($GetUserName); $ReportedPlayer = $UserNameRow['Username']; ?> You may also want to check to make sure you are actually connecting to the database Ray Quote Link to comment Share on other sites More sharing options...
rajeshrr Posted December 17, 2007 Share Posted December 17, 2007 Are you able to get some error message? If not then try executing the same query using phpMyAdmin and see if it works. Regards Rajesh R R ________________ www.rajeshrr.com ------------------- Dreams are for ever ------------------- Quote Link to comment Share on other sites More sharing options...
SirChick Posted December 17, 2007 Author Share Posted December 17, 2007 its sorted thankyou Quote Link to comment Share on other sites More sharing options...
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.