[SOLVED] New at MySQL - connecting to DB not working
Posted: Wed Jul 21, 2004 11:18 am
I am very new at MySQL. I've been using PHP for a while but finally found the need to learn MySQL. I made a DB and this script:
I get this:
I edited some stuff, too - the stuff in bold.
Edit: changed "code" tag to "php" tag.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>MySQL stuff</title>
<link rel="stylesheet" href="/my_style.css" />
</head>
<body>
<table>
<tr style="font-weight:bold;"><td>ID</td><td>First Name</td><td>Last Name</td><td>Password</td></tr>
<table
<?php
$link=mysql_connect("69.72.142.82","[b]*****[/b]_newdb","[b]*****[/b]");
$db=mysql_select_db("[b]*****[/b]_newdb",$link);
$query="SELECT * FROM people";
$result=mysql_query($query,$link);
$numrows=mysql_num_rows($result);
for ($i=0; $i<$numrows; $i++){
$the_arrays=mysql_fetch_array($result);
print("<tr><td>$the_arrays[ID][$i]</td><td>$the_arrays[FirstName][$i]</td><td>$the_arrays[LastName][$i]</td><td>$the_arrays[Password][$i]</td></tr>");
}
?>
</table></body></html>I'm pretty sure the connection isn't working.ID First Name Last Name Password
Warning: mysql_connect(): Access denied for user: 'taken out by author' (Using password: YES) in /home/PATH/people.php on line 12
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/PATH/people.php on line 13
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/PATH/people.php on line 15
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/PATH/people.php on line 16
I edited some stuff, too - the stuff in bold.
Edit: changed "code" tag to "php" tag.