Code: Select all
$db = mysql_connect("localhost", "root");
mysql_select_db("library",$db);Code: Select all
//db_connect.php
<?php
$db_user = 'localhost
$db_pass = 'root
$db_host = 'localhost'; //Usually "localhost"
$db_name = 'library';
$con= @mysql_connect("$db_host","$db_user","$db_pass")
or die ("Cannot connect to MySQL.");
$db = @mysql_select_db("$db_name",$con)
or die ("Cannot select the $db_name database. Please check your details in the database connection file and try again");
?>Code: Select all
Cannot connect to MySQL.Code: Select all
or die ("Cannot connect to MySQL.");
or die ("Cannot select the $db_name database. Please check your details in the database connection file and try again");Code: Select all
Parse error: parse error, unexpected T_VARIABLE in c:\program files\apache group\apache\htdocs\db_connect.php on line 10This is how i always get my Mysql DB up and running...do you see any problem here ? or do you want to suggest a better way that is more widely used?
Code: Select all
i put my "mysql" in C:\
Then I go to C:\mysql\cd bin and click on mysqladmin icon..it asks for a username and password..After i finished providing the necessary information it comes to stay on my status bar and shows green light when the Db server is on and red when it is off....Am i doing anything wrong by starting MySql server like that?Can anybody sheds some light?