aconite Posted February 23, 2007 Share Posted February 23, 2007 I am completely new to PHP and mysql.so im having some prob lems in connecting them i have installed XAMPP1.6.0 (MySql 5.0.33,PHP 5.2.1,Apache 2.2.4). My apache works fine.phpinfo() page is also shown but without any MySql details.but now im trying to run this php file.the browser displays echo statements till "done 4" so im guessing the prob is with mysql_connect.XAMPP shows the mySql service is running. In php.ini file php extention is given.i hav also downloaded libmysql.dll and php_mysqli.dll even that doesnt work.wht should i do code: <?php echo 'done2'; // hostname or ip of server (for local testing, localhost should work) $dbServer='127.0.0.1'; echo 'done2'; // username and password to log onto db server $dbUser='root'; $dbPass=''; echo 'done3'; // name of database $dbName='test'; echo 'done4'; $link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect"); echo 'Connected successfully'; mysql_select_db("$dbName") or die("Could not select database"); print "Database selected successfully<br>"; echo 'done5'; // close connection mysql_close($link); echo 'donehjk'; ?> Quote Link to comment Share on other sites More sharing options...
paul2463 Posted February 23, 2007 Share Posted February 23, 2007 try this <?php $link = mysql_connect($dbServer, $dbUser, $dbPass) or die("Could not connect"); ?> Quote Link to comment Share on other sites More sharing options...
aconite Posted February 23, 2007 Author Share Posted February 23, 2007 still gives the same output ??? Quote Link to comment Share on other sites More sharing options...
paul2463 Posted February 23, 2007 Share Posted February 23, 2007 check user name and password is the only answer, check whether you can connect as root without a password( unless that was removed for security reasons - generally if that is the case a few *** are put there to mean you know something should be there but would rather not print it) try this one see what the error is <?php $link = mysql_connect($dbServer, $dbUser, $dbPass) or die('Could not connect: ' . mysql_error()); ?> Quote Link to comment Share on other sites More sharing options...
aconite Posted February 24, 2007 Author Share Posted February 24, 2007 once again same output ??? i ran th MySQLInstanceConfig file in \MySQL\MySQL Server 5.0\bin. revised all the setting but now the service wont start.It gives error0 ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.