Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Connect to mysql using PHP

    I think I've got a configuration problem.

    When I issue the command

    $link = mysql_connect('localhost','root','<pswd>');
    if (!$link){ die('<message>');

    I never get to the 'if' statment.

    The error I get is:

    "Fatal error: Call to undefined function mysql_connect() in /usr/local/apache2/thdocs/test2.php"

    Does this mean it does not recognize the function or the connect argument?

    I completely new at this and loaded mysql via Red Hat rpm.

    Any suggestions?

  • #2
    Registered User
    Join Date
    Sep 2005
    Posts
    315
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this :
    PHP Code:
    if(!($link_id mysql_connect($hostadres$username$password))) die(mysql_error()); 

  • #3
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP5 doesn't enable MySQL by default.

    This page will be of use -
    http://www.somacon.com/p109.php

  • #4
    Registered User
    Join Date
    Sep 2005
    Posts
    315
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what do you mean mark? Please explain me (i'm a total noob )

  • #5
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The page I linked to explains the problem and solution.

    Basically the MySQL extension library does not come with PHP (in Redhat only I think?), so you need to install it manually.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •