Php Select From Db Tutorial
For this example, we will assume we have already connected to the database and the database contains a table called "customers". We want to return a list names and email addresses for all of the customers in the table.
<ul> <?php $result = mysql_query('select fullname, email from customers'); if (!$result) { die('Could not execute query: '.mysql_errno().':'.mysql_error()); } while ($row = mysql_fetch_array($result)) { echo '<li>'.$row['fullname'] . ' : ' . $row['email'].'</li>'; } ?> </ul>
