HALP I've fallen and I can't get up

From: Date: Sun, 11 Jun 2000 00:35:40 +0000
Subject: HALP I've fallen and I can't get up
Groups: php.db 
Request: Send a blank email to php-db+get-309@lists.php.net to get a copy of this message
Having an issue here with returning a count of entries in a database. $result. The count that $result returns is 2 so that if I use a for loop to generate the query times "see for loop" all I get is 2 records returned.... what I am trying quite poorly to do is use a for loop incrementing from the count of results in a database so that if there are 40 records or 1 record that is returned and the count is generated from there. Please see example. <? $Daze = Date("m-Y") ; $hostname = "*********"; $username = "*****"; $password = "****"; $dbName = "****"; $userstable = "*******"; $mysql_link = MYSQL_CONNECT($hostname,$username,$password); @mysql_select_db("$dbName"); $query = "SELECT * FROM herb_news"; $result = MYSQL_QUERY($query); for($i = 0; $i <= count($result)+1; $i ++){ $news_month = mysql_result($result,$i,"news_date"); $title = mysql_result($result,$i,"news_title"); $news_body = mysql_result($result,$i,"news_article"); if ($news_month == "$Daze"){ print "<p align=\"left\"><font size=4 ><b>$title</b></font></p><p align=\"left\">$news_body</p>"; } } ?> halp please Dan Ellis

« previous php.db (#309) next »