Jump to content

Archived

This topic is now archived and is closed to further replies.

leszekmk

Syntax error comparing e-mail addresses

Recommended Posts

Hi,

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

Share this post


Link to post
Share on other sites

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;

}

 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.