somo Posted July 13, 2006 Share Posted July 13, 2006 Im trying to select and email address of a customer where their username matches the variable in my script. I'm gettin "Unknown column 'somo' in 'where clause' " somo is a username and is in the databse. Any clues?[code]<? //select the email address of the user that is booking $result = mysql_query("SELECT C_Email FROM Customer WHERE U_Username = "$username" LIMIT 1") or die(mysql_error()); $row = mysql_fetch_assoc($result); $C_Mail = $row['C_Email'];// return email?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14492-mysql/ Share on other sites More sharing options...
GingerRobot Posted July 13, 2006 Share Posted July 13, 2006 try:$result = mysql_query("SELECT C_Email FROM Customer WHERE U_Username = '$username' LIMIT 1") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/14492-mysql/#findComment-57365 Share on other sites More sharing options...
brown2005 Posted July 13, 2006 Share Posted July 13, 2006 maybe u need to use '$username' Quote Link to comment https://forums.phpfreaks.com/topic/14492-mysql/#findComment-57366 Share on other sites More sharing options...
brown2005 Posted July 13, 2006 Share Posted July 13, 2006 o someone already said.. lol Quote Link to comment https://forums.phpfreaks.com/topic/14492-mysql/#findComment-57367 Share on other sites More sharing options...
somo Posted July 13, 2006 Author Share Posted July 13, 2006 cheers mate that sorted it, you just don't see them when you look at the code for too long, anyways thanks.[quote author=GingerRobot link=topic=100446.msg396412#msg396412 date=1152804284]try:$result = mysql_query("SELECT C_Email FROM Customer WHERE U_Username = '$username' LIMIT 1") or die(mysql_error());[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/14492-mysql/#findComment-57383 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.