Page 1 of 1

how to connect mysql with php as i am using xampp

PostPosted: 07. July 2008 14:24
by MUHAMMAD AJMAL
How i would connect .php file with fruit database as i have been intalled XAMPP IN
C:/X DIRECTORY?
C:\x\php>php check.php
I am trying to connect check.php file with mysql fruit database table fruit for this I was writing command in check.php are as below
<?$db=mysql_connect("localhost"); mysql_select_db("fruit",$db); $query="SELECT * FROM fruits";
$result=mysql_query($query); $table=mysql_field_table($result,0); echo $table;?>
Output was
Warning: mysql_connect(): Access denied for user 'ODBC'@'localhost' (us
ing password: NO) in C:\x\php\check.php on line 2
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link
resource in C:\x\php\check.php on line 3
Warning: mysql_query(): Access denied for user 'ODBC'@'localhost' (usin
g password: NO) in C:\x\php\check.php on line 5
Warning: mysql_query(): A link to the server could not be established i
n C:\x\php\check.php on line 5
Would any one tell me what’s going wrong OR HOW I WOULD ABLE TO CONNECT MYSQL WITH PHP IN XAMPP?

PostPosted: 07. July 2008 14:55
by Wiedmann
Code: Select all
$db=mysql_connect("localhost");

Warning: mysql_connect(): Access denied for user 'ODBC'@'localhost' (us
ing password: NO)

mysql_connect can have more the one parameter:
--> http://de.php.net/manual/en/function.mysql-connect.php

OR HOW I WOULD ABLE TO CONNECT MYSQL WITH PHP IN XAMPP?

Use an exiting user/password for the connection.
(XAMPP default is "root" with no password)

In xampp i would not able to connect mysql with php.?

PostPosted: 08. July 2008 19:20
by MUHAMMAD AJMAL
kindly briefly tell what should i do to connect to connect mysql with my php file as i were mention in my early post .
HOpe fully now you exactly tell me what should i do kindly do reply me clearly because i am a new user of xampp and php ?
thank you