law Posted June 27, 2008 Share Posted June 27, 2008 I just installed a clients website on another server as they requested. This is the error i get. This error for some reason unknown to me does not appear on my machine that I develop on. Anyone have any ideas? This is a gallery. ================MYSQL EXAMPLE================== // this is NOT the database just a rough example ------------------------------------------ -GalleryNames Table - NAME OF TABLE ------------------------------------------ -id-----NameOfGal-ImageidMax-ImageidMin- COLUMN HEADERS ------------------------------------------ -#(pk)--Varchar----#(ImgID)--#(ImgID)--- TABLE DATA ------------------------------------------ -------------------------------------- -GalleryImages Table - NAME OF TABLE -------------------------------------- -(img)id--------ImgSRC-------ImgTitle- COLUMN HEADERS -------------------------------------- -#(ImgID)------Varchar--------Varchar--- TABLE DATA -------------------------------------- //***ImgSRC points to the location of the picture on the server***\\ Query that is generating the problem. for ($num=1;$num<=$num_rows;$num++){ $galleryqa = "SELECT * FROM gallery WHERE id = $num"; $gallerysqla = mysql_query($galleryqa); // echo "$gallerysqla"; ///========================THIS ECHO RETURNS VALID RESOURCE ID #'s $galleryrowa = mysql_fetch_array($gallerysqla);//<==Problem $gallerytitle[$num] = $galleryrowa[galtitle]; $galleryinfo1[$num] = $galleryrowa[galinfo1]; $galleryinfo2[$num] = $galleryrowa[galinfo2]; $galleryinfo3[$num] = $galleryrowa[galinfo3]; $galleryidmin[$num] = $galleryrowa[imgidmin]; $galleryidmax[$num] = $galleryrowa[imgidmax]; Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/ Share on other sites More sharing options...
discomatt Posted June 27, 2008 Share Posted June 27, 2008 I don't see an error. And looping a query is going to hurt performance. Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-576330 Share on other sites More sharing options...
.josh Posted June 27, 2008 Share Posted June 27, 2008 $galleryrowa = mysql_fetch_array($gallerysqla) or die(mysql_error());//<==Problem Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-576332 Share on other sites More sharing options...
discomatt Posted June 27, 2008 Share Posted June 27, 2008 Syntax looks right. Doesn't look like an error to me... I still don't see an error. Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-576334 Share on other sites More sharing options...
wildteen88 Posted June 27, 2008 Share Posted June 27, 2008 Umm, what's the error you're getting? I don't see you mention the error you get, except telling us you get an error. Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-576338 Share on other sites More sharing options...
law Posted June 29, 2008 Author Share Posted June 29, 2008 i apologize here is the error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /www/includes/gallery.php on line 26 Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-577062 Share on other sites More sharing options...
wildteen88 Posted June 29, 2008 Share Posted June 29, 2008 If you are getting that error, then there is most probably a problem with the query. Change: $gallerysqla = mysql_query($galleryqa); to $gallerysqla = mysql_query($galleryqa) or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-577151 Share on other sites More sharing options...
law Posted June 29, 2008 Author Share Posted June 29, 2008 If you are getting that error, then there is most probably a problem with the query. Change: $gallerysqla = mysql_query($galleryqa); to $gallerysqla = mysql_query($galleryqa) or die(mysql_error()); I changed it to "or die." Yet, I get the same error, and the page does not "die" it continues to populate the rest of the page. here is the code change. $galleryqa = "SELECT * FROM gallery WHERE id = $num"; $gallerysqla = mysql_query($galleryqa); $galleryrowa = mysql_fetch_array($gallerysqla) or die(mysql_error()) //<== line 25; Here is the error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/failsafehomes/www/includes/gallery.php on line 25 Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-577328 Share on other sites More sharing options...
trq Posted June 29, 2008 Share Posted June 29, 2008 Note that the or die call should be after your call to mysql_query(). eg; $gallerysqla = mysql_query($galleryqa) or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-577332 Share on other sites More sharing options...
law Posted June 30, 2008 Author Share Posted June 30, 2008 unfortunately, it didn't die.. im really baffled as to what the issue could be. for ($num=1;$num<=$num_rows;$num++){ $galleryqa = "SELECT * FROM gallery WHERE id = $num"; $gallerysqla = mysql_query($galleryqa) or die(mysql_error()); $galleryrowa = mysql_fetch_array($gallerysqla) or die(mysql_error()); ERROR Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /www/includes/gallery.php on line 27 Could an older version of php on this server cause this issue? Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-578248 Share on other sites More sharing options...
wildteen88 Posted June 30, 2008 Share Posted June 30, 2008 Strange, are you sure that is line 27. Can you post the contents of gallery.php (within in tags). Quote Link to comment https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/#findComment-578435 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.