help Connecting to SQL with PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • AFallis
    Private

    • Feb 2010
    • 1

    help Connecting to SQL with PHP

    I am trying to connect to a database I created using the C-panel. I have the script installed correctly becuse I get a error message that I wrote when I try to go to the home page that says cant connect to sql database. here is the code I have. Can you tell me what I have done wrong?

    <?php
    $db_host = "localhost";
    $db_username = "fepiiakh_Aaron";
    $db_pass = "Du2Ef^JBO.qv";
    $db_name = "fepiiakh_test";

    @mysql_connect("$localhost","$fepiiakh_Aaron","$Du 2Ef^JBO.qv") or die ("Aaron I could not connect to mysql");
    @mysql_select_db("$fepiiakh_test") or die ("no database");
    ?>
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: help Connecting to SQL with PHP

    <?php
    $db_host = "localhost";
    $db_user = "fepiiakh_Aaron";
    $db_pass = "Du2Ef^JBO.qv";
    $db_name = "fepiiakh_test";

    $conn = mysql_connect($db_host, $db_user, $db_pass) or die ("Aaron I could not connect to mysql");
    mysql_select_db($db_name, $conn) or die ("Could not select database");
    ?>
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    Working...
    X