how to connect my MySQL database in php? the scenario is the php is in a free webhost server. not in my localhost server…. I have a problem with that. I know my own localhost IP address but not free webhost IP address.
By admin Posted in: Database Software
how to connect my MySQL database in php? the scenario is the php is in a free webhost server. not in my localhost server…. I have a problem with that. I know my own localhost IP address but not free webhost IP address.
You must be logged in to post a comment.
©2011 Softwares Reviews, All rights reserved.
This would be the code to connect to a database:
// set up the vars to access the database
$hostname = “localhost”; ///usually unless host specifies some other string
$username = “your database user;
$password = “your password”;
$dbName = “your database name”;
$conn = mysql_connect($hostname,$username,$passw…
mysql_error();
mysql_select_db($dbName) or die(“Could Not Connect To Database”);
I put this in a file of its own and then include the file on each page.
First of all note that PHP is free web host server as well as free local server.
You can enjoy with free downloading PHP with MySQL. Its totally free
Link : http://www.brothersoft.com/downloads/php…
Code for connection from PHP to My SQL
< ?php
$localname = "localhost";
$db_user = "root";
$db_pass = "";
$db_name = "web1";
$conn = mysql_connect($localname,$db_user,$db_pa…
mysql_select_db($db_name,$conn);
?>