Hi. On Windows 2000, I installed MySQL and tested it successfully. I installed Apache and PHP. I am using Apache "An own side publishing" (see
http://www.apachefriends.org/en/xampp-windows.html). In other words I plan to build my pilot site on my own computer without trying to make it accessible to the world yet.
I am using the book "PHP & MySQL for dummies" (was loaned to me). I successfully ran the first test in the book, which has the phpinfo() command. That worked.
What I'm stuck on is the next test, where I try to make a mysql connection. The instructions in
www.apachefriends.org/en/xampp-windows.html say to do it like this:
mysql_connect("localhost",
"root","")
;
which I did, but got this error message when I tried to view the file in my browser:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO)
(I am happy working without a password at this point.)
In case you need it, here is the whole source file:
<html>
<head>
<title>Test MySQL</title>
<body>
<!-- mysql_up.php -->
<?php
$host="localhost";
$user="root";
$password="";
/* mysql_connect($host,$user,
$password)
; */
mysql_connect("localhost",
"root","")
;
$sql="show status";
$result = mysql_query($sql);
if ($result == 0)
echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
elseif (mysql_num_rows($result) == 0)
echo("<b>Query executed successfully!</b>");
else
{
?>
<!-- Table that displays the results -->
<table border="1">
<tr><td><b>Variable_name</
b></td><td
><b>Value<
/b></td></
tr>
<?php
for ($i = 0; $i < mysql_num_rows($result); $i++) {
echo("<TR>");
$row_array = mysql_fetch_row($result);
for ($j = 0; $j < mysql_num_fields($result);
$j++) {
echo("<TD>" . $row_array[$j] . "</td>");
}
echo("</tr>");
}
?>
</table>
<?php } ?>
</body>
</html>
Thank you.
Start Free Trial