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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.