You are here: Re: Display Multiple Rows in PHP and MYSQL « PHP Language « IT news, forums, messages
Re: Display Multiple Rows in PHP and MYSQL

Posted by Jim Michaels on 11/21/00 11:37

if you don't need the "no records found", you can remove it like this:

$recset = mysql_query("SELECT * FROM TABLENAME",$db_conn) or die("Error
message if query
fails");
while($row = mysql_fetch_array($recset)) {
//put output code with $row['XML'] here
echo $row['XML'];
echo "here is some $row[XML]\n";
}

(I am used to using mysql_fetch_array - the other function does the same
thing anyway - your choice)

"Snappy" <freethot@libertyhaven.com> wrote in message
news:1136868122.600214.165390@g14g2000cwa.googlegroups.com...
> Try this:
>
> $query = "SELECT * FROM TABLENAME"; //or whatever SQL you want to use
> $recset = mysql_query($query,$db_conn) or die("Error message if query
> fails");
> if( mysql_num_rows($recset) < 1 )
> {
> // no records found for query
> }
> else
> {
> while( $row = mysql_fetch_assoc($recset) )
> {
> //put output code here
> }
> }
>
> If you are using a table to display the records make sure to put the
> table tag and its heading row before the while statement and put the
> closing table tag after the while block. Inside the while loop you
> would code the output for an entire table row.
>
> More help available at http://www.php.net/manual/en/ref.mysql.php look
> up MySQL functions under Functions Reference on sidebar.
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация