My error is 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 '@gmail.com AND active = 1' at line 1 while using this query $q = mysql_query("SELECT friend_email FROM friend WHERE user_email = $user_id AND active = $woo ") or die(mysql_error()); the information that come from it is passed into an array. also I tried putting the variables in '". ."' i also tried remaking the table with different cell names btw the table in user_email varchar(50) friend_email varchar(50) active tinyint anyway for now i give. i played around with it for almost 5 hours now and i need help with this query even more than i need sleep.
You must enclose varchar values with single quotes. $q = mysql_query("SELECT friend_email FROM friend WHERE user_email = '$user_id' AND active = $woo ") or die(mysql_error()); Code (markup):
Wow your a hero. that fixed the mysql error. Unfortunatley i now have an array problem now. the error is Warning: array_push() expects parameter 1 to be array, null given in C:\xampp\htdocs\member.php on line 45 Warning: array_push() expects parameter 1 to be array, null given in C:\xampp\htdocs\member.php on line 45 Warning: array_push() expects parameter 1 to be array, null given in C:\xampp\htdocs\member.php on line 50 Warning: array_push() expects parameter 1 to be array, null given in C:\xampp\htdocs\member.php on line 50 Warning: array_push() expects parameter 1 to be array, null given in C:\xampp\htdocs\member.php on line 50 the code giving me problems is while($r = mysql_fetch_array($q)){ array_push($arrFriendList, $r['friend_email']); } i defined array as $arrFriendlist = array(); anyway sorry to drag this problem out i'm thinking i may have to do this with inegers. maybe assign my user uniqid's?
There shouldn't be any need to use array_push(). Try this, it does the same job. $arrFriendList = array(); while($r = mysql_fetch_array($q)){ $arrFriendList[] = $r['friend_email']; } PHP: As stated on PHP.net Also take care when naming variables, $arrFriendList is different to $arrFriendlist you could of defied $arrFriendlist as an array but be using the capital L somewhere else in the code. Regards, Steve
steve you are amazing. it not only works, but faster. so very kool. thanks to steve and mwasif. you guys saved me hours of bashing my head against a wall. I declare this one fixed!