I used the below code and now i get
Warning: Access denied for user: 'username@localhost' (Using password: YES) in /home/php_student02/public_html/10a-retrieve.php on line 2
Warning: MySQL Connection Failed: Access denied for user: 'username@localhost' (Using password: YES) in /home/php_student02/public_html/10a-retrieve.php on line 2
Warning: Supplied argument is not a valid MySQL result resource in /home/php_student02/public_html/10a-retrieve.php on line 8
Warning: Supplied argument is not a valid MySQL-Link resource in /home/php_student02/public_html/10a-retrieve.php on line 13
What am I doing wrong now?:(
Code:
<?php
$db = mysql_connect('localhost', 'username', 'password');
mysql_select_db('students');
$query = "SELECT * FROM student.contact";
$result = mysql_query($query);
while($r = mysql_fetch_array($result)){
echo "<br>Name: " . $r['name'];
echo "<br>Address: " . $r['address'];
echo "<br>City.state.zip: " . $r['city'] . "." . $r['state'] . "." .
$r['zip'];
}
mysql_close($db);
?>