Posted by Lamer on 10/03/07 14:41
How do I retrieve only one row of database info? here's what I have so
far
<?php
$db_host = "localhost";
$db_user = "username";
$db_pwd = "password";
$db_name = "dbname";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
?>
<table>
<?php
$sql = "SELECT * FROM colors";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['favoriteColor']."</td>";
echo "</tr>";
}
?>
</table>
</body>
</html>
Any help would be great. Thanks again!
Navigation:
[Reply to this message]
|