leszekmk Posted February 29, 2004 Share Posted February 29, 2004 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 Quote Link to comment https://forums.phpfreaks.com/topic/1708-syntax-error-comparing-e-mail-addresses/ Share on other sites More sharing options...
azunoman Posted March 2, 2004 Share Posted March 2, 2004 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; } Quote Link to comment https://forums.phpfreaks.com/topic/1708-syntax-error-comparing-e-mail-addresses/#findComment-5577 Share on other sites More sharing options...
leszekmk Posted March 2, 2004 Author Share Posted March 2, 2004 Yes, it did help. Many thanks! Quote Link to comment https://forums.phpfreaks.com/topic/1708-syntax-error-comparing-e-mail-addresses/#findComment-5579 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.