Jump to content


Syntax error comparing e-mail addresses

  • Please log in to reply
2 replies to this topic

#1 leszekmk

  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 29 February 2004 - 06:12 PM

I am trying to compare an e-mail address assigned to variable $name with those already entered in the table siteusers of my database and am getting rather cryptic error message. Would you please help me identify what the problem is? I am using Dreamweaver MX, PHP 4.3.3, and mySQL 4.0.16.
Thank you.

$name = $row_rsEventData['whoentered'];
mysql_select_db($database, $connection);
$sqlone = "SELECT * FROM siteusers WHERE siteusers.userLoginName = $name";
$result = mysql_query($sqlone,$connCalendar) or die(mysql_error());
$newArray = mysql_fetch_array($result);

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 '@yahoo.com' at line 1

#2 azunoman

  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 02 March 2004 - 07:12 PM

I don't know that this will help...but your $name should be '$name'...here is a copy of some code of mine that does the same as what you are attempting.

many times when I have an error I will insert a echo $query to display the $query string to find the 'about' error. One would think, that if it knows about where it is, then it really knows exactly where it is...lol

function get_usertype($string)
// get the user types
$query = "SELECT * FROM user_types WHERE user_type='$string'";
$result = @mysql_query($query) or die (showerror());
if (!$result) {
return false; }
$result = @mysql_fetch_array($result);
return $result;

#3 leszekmk

  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 02 March 2004 - 08:58 PM

Yes, it did help. Many thanks!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users