MySQL Forums
Forum List  »  PHP

mySQL and PHP connectivity problems
Posted by: Taqi Raza
Date: April 24, 2009 10:09PM

Dear All,
We have a very sime PHP and mySQL web application in which we are only trying to establish connection between php and mysql database , the application has been hosted on iis web server , the configuration and installation is 100% perfect because we have tested some simple php pages after configuring it on iis and the results were fine , now wehn i try to establish connection between php and mysql database it gives error , the source code is as follows:

---------------------------------------------------------------------------------

<?php

print('<b> A Testing PHP Page ....... </b>');

$dbName = "wscdb";
$dbUser = "wscadm";
$dbPass = "samba1234";
//----------------------------

//DO NOT EDIT BELOW THIS LINE
$dbHost = "localhost";

$dbLink=mysql_connect($dbHost, $dbUser, $dbPass);

print('<br>');
if($dbLink)
{
print('<b> Connection successfully established ....... </b>');
}

else
{
print('<b> Connection cannot be established .............. </b>');
}



$db_selected = mysql_select_db($dbName, $dbLink);


print('<br>');
if($db_selected)
{
print('<b> Link successfully established ....... </b>');
}

else
{
print('<b> Link cannot be established .............. </b>');
}

?>

----------------------------------------------------------------------------------

The result which I get is as follows:

A Testing PHP Page .......
Connection successfully established .......
Link cannot be established ..............

Now my question is that why do the mysql_select_db() fails and do not establish the connection with the database although it is present , I have not added mysql to system dsn because it was not stated in the tutorial i am following, please reply as soon as possiable.

Regards,
Taqi Raza.

Options: ReplyQuote


Subject
Written By
Posted
mySQL and PHP connectivity problems
April 24, 2009 10:09PM
April 27, 2009 08:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.