SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast CanWeb's Avatar
    Join Date
    Aug 2004
    Location
    Vanastra, Ontario, Canada
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql_connect error

    I am experiencing a problem with a script to connect o my database. I get this msg:
    Code:
    Fatal error: Call to undefined function mysql_connect() in c:\...\connect.test.php
    and this is the offending line:
    Code:
    $conn = @mysql_connect($mysql_host, $mysql_user, $mysql_password) or die("Sorry, couldn't connect to the datebase!<br>Please try later again!");
    Why would I get an error like this when has been working fine for a few years now?
    Irvin.

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Nigeria
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what version of php are u using?

    if u just upgraded to php 5 then u have not configured it to run with MySql.

  3. #3
    SitePoint Enthusiast CanWeb's Avatar
    Join Date
    Aug 2004
    Location
    Vanastra, Ontario, Canada
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming my host upgraded php to 5.0, what would be the correct way to connect? This is what I currently use:
    Code:
    $conn = @mysql_connect($mysql_host, $mysql_user, $mysql_password) or die("Sorry, couldn't connect to the datebase!<br>Please try later again!");
    $db = @mysql_select_db ($mysql_db) or die("Sorry, could not find the database");
    The vars are declared in an other file which are included on the page.
    Or do you mean that it's not my script but that the mySQL server needs to be re-installed to work?

  4. #4
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like PHp5 was not configured to work with MySQL. You'll wan tto contact your host about this.

    In any case, as of PHP 5.1, you should look into using PDO anyway.
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  5. #5
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah it looks like someone forgot --with-mysql when they typed ./config
    Visit www.dailyspam.net for php tutorials and more.

  6. #6
    SitePoint Enthusiast CanWeb's Avatar
    Join Date
    Aug 2004
    Location
    Vanastra, Ontario, Canada
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like he's uped php to 5.0.x. Phpinfo does not indicate a mySQL server but rather shows something like SQLite. I think I need to change hosts! We got on notice at all about the changes. Sigh.

    Thanks for the help guys.
    Irvin. <><


Bookmarks

Posting Permissions

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