kshyju Posted June 16, 2008 Share Posted June 16, 2008 Dear techies, Please help me to solve this issue I have a PHP site where i am having a mysql db connectivity.while developing i used the following code to connect to the DB and i included this page in all my PHP pages. In my local environment.it was working pretty fine.but when it comes to the deployment stage(in www) It is not working CODe ----------- <?php $link = mysql_connect('mysql400.ixwebhosting.com', 'my_user', 'my_password); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db('my_database'); echo '<br>DB Selected successfully'; $res=mysql_query('select * from students'); $cnt=mysql_num_rows($res); echo "<br> COUNT : ".$cnt; ?> For the above code i am getting an o/p as the following ----------------------------------------------------------------------- Connected successfully DB Selected successfully COUNT : This is the first time i am trying with a live db server. (I am a newbie in PHP) I am able to access the phpMyAdmin from my browser. (http://mysql400.ixwebhosting.com/). when i enter the user name and password, i can see the DB , tables and all Please help me to resolve this Link to comment https://forums.phpfreaks.com/topic/110372-php-live-mysql-server-connectivity-issue/ Share on other sites More sharing options...
tapos Posted June 16, 2008 Share Posted June 16, 2008 Dear techies, Please help me to solve this issue I have a PHP site where i am having a mysql db connectivity.while developing i used the following code to connect to the DB and i included this page in all my PHP pages. In my local environment.it was working pretty fine.but when it comes to the deployment stage(in www) It is not working CODe ----------- <?php $link = mysql_connect('mysql400.ixwebhosting.com', 'my_user', 'my_password); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db('my_database'); echo '<br>DB Selected successfully'; $res=mysql_query('select * from students'); $cnt=mysql_num_rows($res); echo "<br> COUNT : ".$cnt; ?> For the above code i am getting an o/p as the following ----------------------------------------------------------------------- Connected successfully DB Selected successfully COUNT : This is the first time i am trying with a live db server. (I am a newbie in PHP) I am able to access the phpMyAdmin from my browser. (http://mysql400.ixwebhosting.com/). when i enter the user name and password, i can see the DB , tables and all Please help me to resolve this use bellow $link = mysql_connect('mysql400.ixwebhosting.com', 'my_user', 'my_password); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db('my_database') or die('couldn't select db'.mysql_error); echo '<br>DB Selected successfully'; $res=mysql_query('select * from students'); $cnt=mysql_num_rows($res); echo "<br> COUNT : ".$cnt; ?> if you still getting same then there is no record in the database in the students table. Please check the students table again Link to comment https://forums.phpfreaks.com/topic/110372-php-live-mysql-server-connectivity-issue/#findComment-566282 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.