Ask Experts Questions for FREE Help !
Ask
    Dany123's Avatar
    Dany123 Posts: 1, Reputation: 1
    New Member
     
    #1

    Feb 20, 2013, 06:26 AM
    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.
    ericlewis's Avatar
    ericlewis Posts: 2, Reputation: 1
    New Member
     
    #2

    Mar 5, 2013, 04:48 AM
    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){

    }


    ?>
    ericlewis's Avatar
    ericlewis Posts: 2, Reputation: 1
    New Member
     
    #3

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

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

PHP, MySQL, apache l [ 2 Answers ]

I am trying to install php5, the latest version of apache webserver and the latest version of mysql on a windows xp sp2 laptop. I also want to use Zend dev environment to write my php. I can install php4 and apache 1.3.3 with zend, and everything works fine. The problem is I'm trying to use...

Php, apache, mysql [ 3 Answers ]

I am trying to install php5, the latest version of apache webserver and the latest version of mysql on a windows xp sp2 laptop. I also want to use Zend dev environment to write my php. I can install php4 and apache 1.3.3 with zend, and everything works fine. The problem is I'm trying to use...

Connecting to MySQL with PHP on Apache 2.2 [ 2 Answers ]

Hello all, Just a little background on my system. I am running Windows XP Pro SP2. Firewall is disabled. Running Apache 2.2, PHP5 and MySQL server 5.1. I am trying to simple interface with my MySQL database using a webpage running PHP. I have tried using the mysql_connect(host, name,...


View more questions Search