Jump to content

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

Link to comment
https://forums.phpfreaks.com/topic/1708-syntax-error-comparing-e-mail-addresses/
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;

}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.