1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to connect sql with php?

Discussion in 'PHP' started by tarun, Apr 21, 2008.

  1. #1
    i am trying to connect php to sql. but i am not able to do so. plz help me.:confused:
     
    tarun, Apr 21, 2008 IP
  2. softvision

    softvision Peon

    Messages:
    146
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are you trying for mySql or msSql
     
    softvision, Apr 21, 2008 IP
  3. tarun

    tarun Active Member

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    i am trying for mysql
     
    tarun, Apr 21, 2008 IP
  4. tarun

    tarun Active Member

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    it is giving below error


    Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\tarun\index1.php on line 17
     
    tarun, Apr 21, 2008 IP
  5. softvision

    softvision Peon

    Messages:
    146
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    How many php extensions you are using. When I downloaded php and installed from wizard it had numerous extensions uncommented by default. First tell me did you installed php from wizard and or extracted php folder form zip.
     
    softvision, Apr 21, 2008 IP
  6. kreoton

    kreoton Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    check your php.ini (located in your php install directory) search for

    if you see semicolon at the beginning of line delete it and restart apache
     
    kreoton, Apr 21, 2008 IP
  7. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #7
    ^ or if you don't have access to PHP.ini:

    <?php php_info( ); ?>
    PHP:
    Then do a search for 'MySQL' on thate page.
     
    Xtrm2Matt, Apr 21, 2008 IP
  8. FUNNYBIRD

    FUNNYBIRD Peon

    Messages:
    76
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    <?php
    $dphost = 'localhost';
    $dpuser = 'root';
    $dppass = 'password';

    $conndp = mysql_connect($dphost, $dpuser, $dppass) or die ('Error connecting to mysql');

    $dpname = 'FunnyBird';
    mysql_select_dp($dpname);
    ?>
     
    FUNNYBIRD, Apr 21, 2008 IP
  9. nation-x

    nation-x Peon

    Messages:
    59
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    you went on a 'p' frenzy

    
    <?php
    $dbhost = 'localhost';
    $dbuser = 'root';
    $dbpass = 'password';
    
    $conndb = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
    
    $dbname = 'FunnyBird';
    mysql_select_db($dbname);
    ?>
    
    PHP:
     
    nation-x, Apr 21, 2008 IP
  10. tarun

    tarun Active Member

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #10
    It is working thank you
     
    tarun, Apr 29, 2008 IP