<?
$l = mysql_connect("localhost", "voetsjoeba","--hidden--");
mysql_select_db("voetsjoeba");
$q = "SELECT * FROM news";
$r = mysql_query($q, $l);
$nrows = mysql_num_rows($r);
print $nrows;
mysql_close($l);
?>
Well, I’ve waited for it to finish now, and it sais this:
Fatal error: Maximum execution time of 30 seconds exceeded in /home/voetsjoeba/HTML/test/news.php on line 8
:-\
try that and tell me what number it prints out.
*Originally posted by Jubba *
**
<?
$l = mysql_connect("localhost", "voetsjoeba","--hidden--");
mysql_select_db("voetsjoeba");
$q = "SELECT * FROM news";
$r = mysql_query($q, $l);
$nrows = mysql_num_rows($r);
print $nrows;
mysql_close($l);
?>
**
K, lemme try that
is there only one row in your news table?
Yeah, for now only one, I’m going to add some later.
<?
$l = mysql_connect("localhost", "voetsjoeba","--hidden--");
mysql_select_db("voetsjoeba");
$q = "SELECT * FROM news";
$r = mysql_query($q, $l);
if($r){
$nrows = mysql_num_rows($r);
$output="";
for ($i=0; i < $nrows; $i++){
$row = mysql_fetch_array($qr);
$output .= "&i=".$i;
$output .= "&img".$i."=".$row['img'];
$output .= "&datum".$i."=".$row['datum'];
$output .= "&inhoud".$i."=".$row['inhoud'];
}
print $output;
}
else
{
print mysql_error($l);
}
mysql_close($l);
?>
see what that gives you.
a million times Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/voetsjoeba/HTML/test/news.php on line 14
lol oops. yeah
change that line to
$row = mysql_fetch_array($r);
forgot to change the result variable…
OMG! I just saw the error that was causing all these problems! look at your for loop! The middle statement! You aren’t using a variable! You are just saying i it has to be $i!!!
It looks like it’s starting it’s loop again … waits … Here’s what is sais:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 9 bytes) in /home/voetsjoeba/HTML/test/news.php on line 16
look at my last post ^
*Originally posted by Jubba *
**OMG! I just saw the error that was causing all these problems! look at your for loop! The middle statement! You aren’t using a variable! You are just saying i it has to be $i!!! **
AAAAAAAAAAAAAAAAAAAARGH Thanks for noticing that ! I’m gonna try my original code with that changed.
stupid small insignificant errors!
Yeah I know we’re posting all through eachother, you’re always a little bit before me
IT WORKS !!! http://voetsjoeba.xszone.nl/test/news.php.
Jubba: thankyouthankyouthankyouthankyou…x1000…
I’m so happy ! Thanks Jubba (and ahmed )