In brief, and in no way finished (no error trapping, commenting, etc)...

<?
        $db = mysql_connect("localhost", "root");

        mysql_select_db("test",$db);

        $result = mysql_query("SELECT CountryID, CountryName FROM
tblcountries",$db);

        echo "<table border=1>\n";
        echo "  <tr>\n";
        echo "    <td>CatNumber</td>\n";
        echo "    <td>Title</td>\n";
        echo "  </tr>\n";

        while ($myrow = mysql_fetch_row($result))
        {

                echo "<tr>\n";
                echo "  <td>$myrow[0]</td>\n";
                echo "  <td>$myrow[1]</td>\n";
                echo "</tr>\n";

        }

        echo "</table>\n";
?>

hth,

 .ben

> -----Original Message-----
> From: Mantas Kriauciunas [mailto:[EMAIL PROTECTED]]
> Sent: 22 April 2002 01:07
> To: PHP General List
> Subject: [PHP] MySQL question
>
>
> Hey PHP General List,
>
>   Amm... can anybody point me to some good tutorial that talks about
>   SELECT from detabase? what i need is ... like i have table with lots
>   of rows.... and i need to output them all to the page... it goes
>   like most of news sections in the page... thanks for help.
>   (i need to learn more about SELECT'ing things from database)
>
> :------------------------------:
>         Have A Nice Day!
>  Mantas Kriauciunas A.k.A mNTKz
>
> Contacts:
> [EMAIL PROTECTED]
> Http://mntkz-hata.visiems.lt
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to