how to connect mysql with php as i am using xampp

Problems with the Windows version of XAMPP, questions, comments, and anything related.

how to connect mysql with php as i am using xampp

Postby MUHAMMAD AJMAL » 07. July 2008 14:24

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?
MUHAMMAD AJMAL
 
Posts: 7
Joined: 07. July 2008 10:23
Location: Karachi

Postby Wiedmann » 07. July 2008 14:55

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)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

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

Postby MUHAMMAD AJMAL » 08. July 2008 19:20

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
Assalamu Alicum,



Thank you
Regard
M.Ajmal
MUHAMMAD AJMAL
 
Posts: 7
Joined: 07. July 2008 10:23
Location: Karachi


Return to XAMPP for Windows

Who is online

Users browsing this forum: Bonniem and 61 guests