Jump to content


Photo

Mysql...


  • Please log in to reply
4 replies to this topic

#1 somo

somo
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 13 July 2006 - 03:22 PM

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?


<?
	//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
?>


#2 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 13 July 2006 - 03:24 PM

try:

$result = mysql_query("SELECT C_Email FROM Customer WHERE U_Username = '$username' LIMIT 1") or die(mysql_error());

#3 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 13 July 2006 - 03:25 PM

maybe u need to use '$username'

#4 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 13 July 2006 - 03:26 PM

o someone already said.. lol

#5 somo

somo
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 13 July 2006 - 03:39 PM

cheers mate that sorted it, you just don't see them when you look at the code for too long, anyways thanks.

try:

$result = mysql_query("SELECT C_Email FROM Customer WHERE U_Username = '$username' LIMIT 1") or die(mysql_error());






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users