hello everyone can somebody help with prolem.
i already successfully istalled php and apache2 and already test it. but my problem is the connection for the mysql, which i use the include script.. i check the include file but there is nothing wrong with it..here's the sample error i encouter

Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\www\includes\sql.php on line 2

this is my include connection script

<?
$db=mysql_connect("localhost","root","admin");
$dbname = "inventory";
mysql_select_db($dbname,$db);
?>

please help..

Recommended Answers

All 3 Replies

I think there is a mistake of passing argument in mysql_select_db() which is used to select the database. You are passing two arguments. It should be like this mysql_select_db($dbname);

<?
$db=mysql_connect("localhost","root","admin");
$dbname = "inventory";
mysql_select_db($dbname);
?>

If that is not the problem, then it might be the problem in mysql_connect(). You can omit the argument for username and password if you are using default username and password.

<?
$db=mysql_connect("localhost");
$dbname = "inventory";
mysql_select_db($dbname);
?>

It is a good practice to include an error message for each statement so that it is easy to find which part of your statement is wrong. Hope it helps.

rinoa04,
thanks for your quick response, but still the error appears in the browser... install the apache2 working and i was able to test it also the php..i don't know if there is problem with my installation.. any suggestions??

I am not sure what is the exact problem. It might be due to your installation or most probably due to the configuration setting of your php in which cause the php unable to support mysql. This usually happened if you installed php+mysql+apache one by one manually. You can search in the web for help in proper installation configuration and also your problem. Below is one of the link you can refer to:
http://www.phplivesupport.com/documentation/viewarticle.php?uid=1&aid=73&pid=3


If you still can't solve the problem, then I suggest you to install a package software consists of php+mysql+apache together where you don't have to worry much on the configuration.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.