MySQL Forums
Forum List  »  PHP

Connecting mysql from php (through web)
Posted by: Imran Syed
Date: April 19, 2016 08:04AM

Hello everyone
How I can connect mysql server (with real ip and different open port) using php mysqli_connect function.
My php page is working fine when i connect it using localhost but from web hosted php page, unable to connect to mysql server.
my connection code is :

<?php
$obj = mysql_connect('00.00.000.000:10005', 'username', 'password');
if (!$obj) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db("clouderp",$obj);
?>
00.00.000.000 is real ip


thanks & regards,
Imran

Options: ReplyQuote


Subject
Written By
Posted
Connecting mysql from php (through web)
April 19, 2016 08:04AM


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.