Jump to content

Array issue only on server computer


law

Recommended Posts

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];

Link to comment
https://forums.phpfreaks.com/topic/112253-array-issue-only-on-server-computer/
Share on other sites

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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.