RE: [PHP-DB] Error testing MySQL
| From: | Bastien Koert | Date: | Tue, 28 Jun 2005 13:27:02 +0000 |
| Subject: | RE: [PHP-DB] Error testing MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39809@lists.php.net to get a copy of this message | ||
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@hotmail.com> To: php-db@lists.php.net Subject: [PHP-DB] Error testing MySQL Date: Tue, 28 Jun 2005 10:23:55 +0200From: Jordens Michiel <jordens_m@hotmail.com> To: php-db@lists.php.net, php-db@lists.php.net Subject: Error testin MySQL Date: Tue, 28 Jun 2005 15:51:42 -0700 Hello All, Im trying to test MySQL. The code that Im 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@hotmail.com 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