RE: [PHP-DB] listing

From: Date: Thu, 23 Aug 2001 19:37:07 +0000
Subject: RE: [PHP-DB] listing
Groups: php.db 
Request: Send a blank email to php-db+get-11752@lists.php.net to get a copy of this message
Assuming you've opened a MySQL connection and stored connection in $connect: $query="SELECT * FROM mytable"; $result = mysql_query($query,$connect) or die("ERROR"); print "<TABLE>"; while( $row = mysql_fetch($result) { print "<TR><TD>".$row['field1']."<TD>".$row['field2']."<TD>".$row['field3']."</TR> "; } print "</TABLE>"; mysql_free_result($result); The above will create a table and output one table row per row in database. Change field1, fiedl2, field3 to the names of fields in the database. Richard Emery Excel Communications, Inc. IT Sr. Project Manager (972) 478-3398 (972) 944-0542 (pager) There is no "trying"... There is only "Do" or "Not Do" -----Original Message----- From: Andrius Jakutis [mailto:andrius@internetmedia.lt] Sent: Thursday, August 23, 2001 11:22 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] listing This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? "Chris Hobbs" <chobbs@silvervalley.k12.ca.us> wrote in message news:3B854E6D.1020107@silvervalley.k12.ca.us... > Something like: > > <? for($i=1; $i<25; $i++) { ?> > <table> > <tr> > <td> > <? > // php code to output your entry information > ?> > </td> > </tr> > </table> > > <? } ?> > > Andrius Jakutis wrote: > > > Hello again, > > > > Is there oportunity to write this: > > > > <some php command to loop entries, the way is written bellow> > > HTML php coding.+ MYSQL - 1 entries information > > <end of loop> > > > > Something like that: > > > > <here loop begins> > > <table> > > <tr> > > <td> > > first entry information from table "companies" (name, telephone...) > > </td> > > </tr> > > </table> > > <loop ends> > > > > > > > > THanks. > > > > > > -- > > Su pagarba, > > > > Andrius Jakutis > > InternetMedia > > http://www.internetmedia.lt > > GSM: 370 82 31332 > > > > > > > > > > > > > -- > Chris Hobbs Silver Valley Unified School District > Head geek: Technology Services Coordinator > webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ > postmaster: chobbs@silvervalley.k12.ca.us > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#11752) next »