MySQL Forums
Forum List  »  Newbie

Accessing MySQL Databases Using PHP
Posted by: Erol Salih
Date: June 30, 2005 04:09PM

Hi,

I am teaching myself MySQL and PHP from a book (Essential PHP fast).

I have successfully installed "OmniSecure 3.0 Web Server" from (http://www.omnicron.ca/httpd/download.html) for windows XP Pro.
I have tested this by creating simple PHP.

I have also successfully installed "MySQL 4.1.12" from "mysql-essential-4.1.12a-win32" which I have downloaded from (http://dev.mysql.com/downloads/mysql/4.1.html) for windows XP Pro.
I have tested this by creating databases and tables using "MySQL Command Line Client".

So far so good (well I had problems which I have managed to solve).

Now the real problem I am having.

I first better mention: I have two physical hard derives on my PC.

MySQL is at:
C:\Program Files\MySQL\MySQL Server 4.1\bin

OmniSecure 3.0 Web Server (and my PHP programs) is at:
D:\Program Files\httpd\htdocs.

This is my PHP program:
<html>
<head>
<title>chapt12-1.php Reading Database</title>
</head>
<body>
<?php
$db = mysql_connect("localhost", "root", "password");
mysql_select_db("exampledb", $db);
$result = mysql_query("SELECT * FROM clients",$db);
echo("First Name: " . mysql_result($result,0,"firstname") . "<br>\n");
echo("Last Name: " . mysql_result($result,0,"lastname") . "<br>\n");
echo("User Id: " . mysql_result($result,0,"userid") . "<br>\n");
echo("Password: " . mysql_result($result,0,"password") . "<br>\n");
?>
</body>
</html>

I know my password is correct.

I am running the script as I have run other php scripts (http://localhost/chapt12-1.php) from the browser.

This is what happens:
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in D:\Program Files\httpd\htdocs\chapt12-1.php on line 7

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in D:\Program Files\httpd\htdocs\chapt12-1.php on line 8

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in D:\Program Files\httpd\htdocs\chapt12-1.php on line 9

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in D:\Program Files\httpd\htdocs\chapt12-1.php on line 10
First Name:

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in D:\Program Files\httpd\htdocs\chapt12-1.php on line 11
Last Name:

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in D:\Program Files\httpd\htdocs\chapt12-1.php on line 12
User Id:

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in D:\Program Files\httpd\htdocs\chapt12-1.php on line 13
Password:

Please someone help.
Best wishes,
Erol

Options: ReplyQuote


Subject
Written By
Posted
Accessing MySQL Databases Using PHP
June 30, 2005 04:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.