Hi, I am not really great at programing so any help would be more than appriciated! I am getting a syntax error message about this argument: mysql_fetch_array It has been working fine until 3 days ago my host upgraded from MySQL 5.0 to 5.1 any ideas?? <? $newban = mysql_query ("select banner from idev_banners where id = $banid"); $banid = mysql_fetch_array($newban); $imgid = $banid[banner]; ?> Code (markup):
try <? $newban = mysql_query ("SELECT `banner` from idev_banners where `id` = '".$banid."'"); $banid = mysql_fetch_array($newban); $imgid = $banid['banner']; ?> just a thought. check your capitals too, your host might have made your table case sensitive. If you post the whole error it'll make our lives much easier
try this..it will load and display all banners as list.. <? $newban = mysql_query ("select banner from idev_banners where id = $banid"); while($banid = mysql_fetch_array($newban)) { $imgid = $banid['banner']; echo $imgid."<br>"; } ?>
Use mysql_error() to identify error. $newban = mysql_query ("select banner from idev_banners where id = $banid") or die("Error: ". mysql_error()); Code (markup):
I added the or die part and this is what it said: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/******/public_html/ads/banners.php on line 11 Warning: Cannot modify header information - headers already sent by (output started at /home/hubalo/public_html/ads/banners.php:11) in /home/*****/public_html/ads/banners.php on line 13 Line 11 in the banners.php file is the same thing: $banid = mysql_fetch_array($newban); I am so lost....
I also checked to see if any of the database tables were case sensetive, and they are not, they all look the same (from what I can tell!)
<? $newban = mysql_query ("select banner from idev_banners where id = '$banid' "); $banid = @mysql_fetch_array($newban); $imgid = $banid['banner']; ?> copy paste that
Still have the same error.... Anyone? Any other ideas? Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/*****/public_html/ads/banners.php on line 11 Warning: Cannot modify header information - headers already sent by (output started at /home/hubalo/public_html/ads/banners.php:11) in /home/*****/public_html/ads/banners.php on line 13
Can you tell how did you use mysql_error() with your code? It is better to post the piece of code where you have used mysql_error().