Error 0 means that there were no errors in the execution of the query. It
does not mean that the query actually returned results that you expect.
Bastien
From: "Michiel Jordens" <jordens_m@xxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject: Error testing MySQL
Date: Tue, 28 Jun 2005 10:23:55 +0200
From: Jordens Michiel <jordens_m@xxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx, php-db@xxxxxxxxxxxxx
Subject: Error testin MySQL
Date: Tue, 28 Jun 2005 15:51:42 -0700
Hello All,
I?m trying to test MySQL.
The code that I?m using is below.
<html>
<head>
<title>PHPtest</title>
</head>
<body>
<!--mysql_up.php -->
<?php
$host="localhost";
$user="root";
$password="(i ain't telling you :p)";
mysql_connect($host,$user,$password);
$sql="show status";
$result = mysql_query($sql) ;
if (result == 0)
echo "<b>Error " . mysql_errno() . ":"
. mysql_error() . "</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>
If I enter my $password and $use this is the message that I get : Error 0:
(like it is in the code if $ result == 0 ....
If I give in a blank $password this is the message that I get :
Warning: mysql_connect() [function.mysql-connect]: Access denied for user
'root'@'localhost' (using password: NO) in C:\www\mysql_up.php on line 13
Warning: mysql_query() [function.mysql-query]: Access denied for user
'ODBC'@'localhost' (using password: NO) in C:\www\mysql_up.php on line 15
Warning: mysql_query() [function.mysql-query]: A link to the server could
not be established in C:\www\mysql_up.php on line 15
Error 1045:Access denied for user 'ODBC'@'localhost' (using password: NO)
The problem is that I'm not sure about my $user. The $password is the same
as Ii give in during the installation.
Thanks for your help,
jordens_m@xxxxxxxxxxx
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Bescherm je Inbox: Phishing - hoe te herkennen, rapporteren en voorkomen
http://www.msn.be/security/phishing/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php