Need Help on Outputting SQL
Posted: Wed Nov 29, 2006 6:00 pm
I have an sql database with a table in it. This table has two rows. ONe is username and another is password. I want to have a php page that dynamically displays all of the information under the username category.
I tried to create a code, but it does not work. The code I tried is:
However, it gives these errors:
Thanks. 
I tried to create a code, but it does not work. The code I tried is:
Code: Select all
<?php
$link = mysql_connect('localhost', 'root', 'my_password_was_here');
$sql = "SELECT username FROM beta";
$query = mysql_query($sql, $var);
while($row = mysql_fetch_row($query)) {
echo $row[0].'<br />';
}
?>Code: Select all
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\Program Files\xampp\htdocs\php\db_test2.php on line 5
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\php\db_test2.php on line 7