Page 1 of 1

Array causing page to fault

Posted: Sat Aug 16, 2003 5:15 pm
by robster
Hi all,

I'm so dissapointed. I spent all night getting this page working (there's a LOT more than is shown here) and as i was about to retire to bed all pleased with myself I ran it again to admire the new page and the browser showed a blank (white) page.

eh?! I though. What's all this about.

I figuired I've pressed a key somewhere in my code and start to go thru it line by line commenting out each line to find the offending line.

I end up, having THIS line (of all the lines) that is causing my page not to load:

Code: Select all

 $ShowMax = mysql_num_rows($content);

I just don't understand it?! It works on EVERY page I've got, it work(ed) on this page until for some reason it decided not to. I've even re-booted the pc (Mac ;) ) and it still does the same thing.

The only way I can get the page to load (without database content) is by commenting out the line as per below:

Code: Select all

$dir = "DESC";
  	mysql_select_db($dbname);
	$sql = "SELECT * FROM archives ORDER BY id $dir";
	$content = mysql_query($sql);
	$Xcontent = mysql_fetch_array($content);





	//Show the date picker menu
	print "<a href="archives_yearly.php?yearly=2003">2003 - </a>";
	print "<a href="archives_yearly.php?yearly=2002">2002 - </a>";
	print "<a href="archives_yearly.php?yearly=2001">2001 <br><br></a>";
	
	
	//Setup array for month sorting
	$aMonths = array();

 
	//show 12 months worth of $month  ERROR ERROR ERROR!!!  WHY!?!?!
	//$ShowMax = mysql_num_rows($content);

If ANYONE has even the foggiest of what wierd voodoo mojo has gone on here I'd love to hear your thoughts...

SOB :( All that work, and then THIS!?!?!?


thanks heaps,

Rob

Posted: Sat Aug 16, 2003 5:17 pm
by robster
update below

Posted: Sat Aug 16, 2003 5:20 pm
by robster
Hi all,

What I did was comment out the line for the array:

Code: Select all

//Setup array for month sorting
	//$aMonths = array();

and uncomment the line:

Code: Select all

$ShowMax = mysql_num_rows($content);
and it allowed the page to then load... BUT... that's no good, because I need that array.



So it seems that the array line is faulting all the lines beneath it (although it DID work for a few hours). Does anyone have any ideas on this?

Thanks again.

Rob

Posted: Sun Aug 17, 2003 6:57 am
by robster
Sorry to shove this to the top. It's really urgent and I just can't find the solution. I've looked at php.net docs and asked around, but nobody seems to know much about it.

Are there any array guru's on this list?

Thanks a bunch.

Rob

Posted: Sun Aug 17, 2003 8:36 am
by delorian
At the begining put the following line:

Code: Select all

error_reporting(E_ALL);
and see what errors (notices) have you got. I can't see the problem right here, so maybe there's something else. BTW: You shouldn't overuse the print function if it is not necessary, right it is right here. Use echo instead.