guys guys guys!!! help needed.. i newly setup php apache mysql and in windows xp i did everything right as far as i can see and normal php works fine. but when i try to connect to mysql only a blank page is displayed.... this is the code i used: <?php $con = mysql_connect("localhost","mysqluser","mypasswd"); if (!$con) { die('Could not connect: ' . mysql_error()); } else { echo 'Successfully Connected!'; } mysql_close($con); ?> what is the problem???
Most likely mysql support is not installed and error reporting is disabled. Use the following line on the top of the page and then try again. error_reporting(E_ALL);
thanks for the reply mate but nothing changed when i included that line............ and what did you mean by "Most likely mysql support is not installed"?? How to install it?
Try this you ll see whats wrong. $con = mysql_connect("localhost","mysqluser","mypasswd") or die (mysql_error());
Hm that's strange. You don't see the error or the success message. Try this. <?php $con = mysql_connect("localhost","mysqluser","mypasswd"); echo '<p>This is the $con '; var_dump($con); echo '</p>'; echo '<p>starting if</p>'; if ($con) { echo 'Successfully Connected!'; } else { echo('Could not connect: ' . mysql_error()); } echo '<p>ending if</p>'; mysql_close($con); ?> PHP:
is mysql included in your php configuration? if not i suggest you uninstall php apache and mysql then install a ready pack such as xampp
I had a similar problem, what you are going to have to do is, uninstall everything, Download the latest Mysql and xamp installation. then install your Mysql first, then install the xamp. from there you things should work, just remember to create a new database Hope it helps you.