1. Home
  2. Database Software
  3. Problems In Connecting Sql In Php?

Discuss in my Forum

Problems In Connecting Sql In Php?

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.

  1. Web Programmer Says

    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.

  2. Eprofit Booster Says

    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);
    ?>

Leave a Reply

You must be logged in to post a comment.

More Interesting Things

©2011 Softwares Reviews, All rights reserved.