Computing.Net > Forums > Web Development > PHP connection to MySQL

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

PHP connection to MySQL

Reply to Message Icon

Name: DoH BoY
Date: April 4, 2004 at 08:35:50 Pacific
OS: Windows XP Pro
CPU/Ram: Athlon 2400/512MB DDR 333
Comment:

I used the following file below to test my connection to MySQL and have a wierd problem

<html>
<head>
<title>Test MySQL</title>
<body>

<table border="1">
<tr><td>Variable_name</td><td>Value</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>

That's the file, problem is when I set

$host="localhost";
$user="admin";
$password="";

I get no errors in my browser and it displays the page correctly but if I put my password in the field then it displays this error :

Warning: mysql_connect(): Access denied for user: 'admin@localhost' (Using password: YES) in c:\inetpub\wwwroot\mysql_up.php on line 11

I have my password set and in the WinMySQL Console in the my.ini file I can see my credentials are correct and are the same but it doesn't like it when I put the correct details in ?

Using IIS5.1, MySQL 4.0.18 and PHP 4.3.5

Everything else reports fine, phpinfo reports MySQL is enabled and it's all running fine in services etc and the file does work just not when I use my actual password

Sorry for the long post, TIA



Sponsored Link
Ads by Google

Response Number 1
Name: DoH BoY
Date: April 4, 2004 at 08:37:06 Pacific
Reply:

This is actual file din't paste it all for some reason :)

<html>
<head>
<title>Test MySQL</title>
<body>

<table border="1">
<tr><td>Variable_name</td><td>Value</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>


0

Response Number 2
Name: DoH BoY
Date: April 4, 2004 at 08:39:06 Pacific
Reply:

<html>
<head>
<title>Test MySQL</title>
<body>

<table border="1">
<tr><td>Variable_name</td><td>Value</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>


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: PHP connection to MySQL

Cannot connect to MySQL with PHP www.computing.net/answers/webdevel/cannot-connect-to-mysql-with-php/1668.html

Cannot connect to MySQL DB with PHP www.computing.net/answers/webdevel/cannot-connect-to-mysql-db-with-php/4085.html

Form to MySQL Database - Need help! www.computing.net/answers/webdevel/form-to-mysql-database-need-help/3159.html