Re: Select and loop through records???
| From: | David Robley | Date: | Mon, 07 Aug 2000 01:50:09 +0000 |
| Subject: | Re: Select and loop through records??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10393@lists.php.net to get a copy of this message | ||
On 5 Aug, Curtis Cole wrote:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
> <title>Learning PHP</title>
> </head>
>
> <body>
>
>
> <?
> $connection = mysql_connect("localhost","username","password") or
> die
> ("Unable to connect to MySQL server.");
> $db = mysql_select_db("name_of_database") or die ("Unable to select
> requested database.");
> ?>
>
> how do I select all records from a table????????????????
>
> <table>
> <tr>
> <td>display field 1</td>
> <td>display field 2</td>
> <td>display field 3</td>
> </tr>
>
> how do i display each record????????????????
>
> do while records are not end of file
> <tr>
> <td>display field 1</td>
> <td>display field 2</td>
> <td>display field 3</td>
> </tr>
> records movenenet
> loop
>
> </table>
>
The example in the manual for mysql_fetch_array() shows a loop using
While. To select all records in a table, use SELECT * FROM table.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA