Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Internet & the Web (https://www.askmehelpdesk.com/forumdisplay.php?f=177)
-   -   Connect php to mysql from apache server (https://www.askmehelpdesk.com/showthread.php?t=735159)

  • Feb 20, 2013, 06:26 AM
    Dany123
    connect php to mysql from apache server
    please can someone help to figure these things out. I wrote these codes to connect to my database but it is not connecting even when I assume that is connected to the database but it is not responding that is connected, this is the code

    <?php
    // connecting to Database
    $db_server = 'localhost:3306';
    $db_user = 'root';
    $db_password = 'password';

    $db_mysql_connect($db_server,$db_user,$db_password ) or die (' The connect could not be established');
    $db_check = mysql_select_db ($db_name);
    if (db)
    echo 'connect to Database established';
    ?>

    and this is the responds:-

    Fatal error: Function name must be a string in C:\xampp\htdocs\connectionfile.php on line 7

    but I can not figure it out.
  • Mar 5, 2013, 04:48 AM
    ericlewis
    hey Deny try the below code

    <?php

    $db_host = "localhost";
    $db_name = "YOUR DB NAME";
    $db_user = "root";
    $db_pass = "password";

    $con = mysql_connect($db_host,$db_user,$db_pass);

    if($con){

    }


    ?>
  • Mar 5, 2013, 04:49 AM
    ericlewis
    If($con){
    Mysql_select_db($db_name,$con);
    }

  • All times are GMT -7. The time now is 10:39 AM.