Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
02-21-2010, 02:13 PM #1
- Join Date
- Oct 2009
- Thanked 3 Times in 3 Posts
mysql_fetch_array() not working for some reason
I am unable to figure out why i can not get the results to go in an array.
this is what code i originally had in my code but now it does not work where it did a few years ago.
seems my code is out of date
can anyone advise what i should do to update it so it is working again.
$result=mysql_query("SELECT * FROM `table` WHERE `field`='" . $info. "' LIMIT 1"); $row=mysql_fetch_array($result); $n=$row[field1]; $e=$row[field2];
02-21-2010, 04:03 PM #2
- Join Date
- Mar 2009
- United Kingdom
- Thanked 28 Times in 28 Posts
There could be multiple reasons, first what springs to mind is the use of `` only use them if nothing else works and only for columns at that as SQL is probably getting confused with selecting from a column. So heres what i would do :
This should work if not it will give us an error telling us what is wrong.PHP Code:
$result=mysql_query("SELECT * FROM table WHERE field='$info' LIMIT 1") or die(mysql_error());
Hope this helps!