SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Location
    West Allis, Wisconsin, United States
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I'm getting a call to undefined function error

    I ran my script on ideone.com and it gave me the following message

    Fatal error: Call to undefined function mysql_connect() in /home/CoJP1z/prog.php on line 18

    in line 18 I have this code

    mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");

    what am I doing wrong?

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    seems like mysql isn't configured to work with php.

  3. #3
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,578
    Mentioned
    62 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by DaMighty Optiq View Post
    I ran my script on ideone.com and it gave me the following message

    Fatal error: Call to undefined function mysql_connect() in /home/CoJP1z/prog.php on line 18

    in line 18 I have this code

    mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");

    what am I doing wrong?
    I assume that www.ideone.com is NOT your site?

    The code you supplied is using your "$db_host","$db_username","$db_pass" and trying to connect to a database on their server.
    Last edited by John_Betong; Oct 1, 2012 at 23:20. Reason: spelling: not my fortay and replaeced http with www

  4. #4
    SitePoint Member
    Join Date
    Sep 2012
    Location
    West Allis, Wisconsin, United States
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ideone.com is a site where you can test your scripts for errors... so it's set up to know the difference... it works for php, css, html, C++, Javascript, JSON, Pearl n a bunch of others... but neither of you said I had an error with my coding so I'm guessing I got it right?

  5. #5
    SitePoint Member
    Join Date
    Sep 2012
    Location
    West Allis, Wisconsin, United States
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OH YEAH!!!..... n my domain is setup for it because I coded some php tables and ran the pages and those went in fine...

  6. #6
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,578
    Mentioned
    62 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by DaMighty Optiq View Post
    ideone.com is a site where you can test your scripts for errors... so it's set up to know the difference... it works for php, css, html, C++, Javascript, JSON, Pearl n a bunch of others... but neither of you said I had an error with my coding so I'm guessing I got it right?
    I use the following for dynamically testing scripts and no need to copy and paste to a third-party tester:

    PHP Code:
    <?php
     error_reporting
    (-1);
     
    ini_set('display_errors',true);
    ...
    ?>
    for HTML and CSS:
    FireFox Html Validator 0.9.5.1

    Php errors are displayed immediately.

    HTML errors are shown by using your browser to view source also can use:
    "http://validator.w3.org/"

    CSS errors are checked using the folllowing:
    "http://jigsaw.w3.org/css-validator/

  7. #7
    SitePoint Member
    Join Date
    Sep 2012
    Location
    West Allis, Wisconsin, United States
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I saw that on this site yesterday and tried it... and I got this error

    Warning: ini_set() has been disabled for security reasons in /www/zxq.net/o/p/t/optiq-customtees/htdocs/storeadmin/connect_to_mysql.php on line 3

    and lines 1-3 is that code....

  8. #8
    SitePoint Enthusiast
    Join Date
    Jul 2007
    Location
    San Sebastian, Spain
    Posts
    93
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You need to install the MySQL module extension for PHP on your server. Also make sure that the MySQL client software is also installed on your server.

  9. #9
    SitePoint Member
    Join Date
    Sep 2012
    Location
    West Allis, Wisconsin, United States
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rcashell View Post
    You need to install the MySQL module extension for PHP on your server. Also make sure that the MySQL client software is also installed on your server.
    I think it is already... I have a few other php files I coded to make tables and those worked fine.

  10. #10
    SitePoint Member
    Join Date
    Sep 2012
    Location
    West Allis, Wisconsin, United States
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rcashell View Post
    You need to install the MySQL module extension for PHP on your server. Also make sure that the MySQL client software is also installed on your server.
    I think it is already... I have a few other php files I coded to make tables and those worked fine.

  11. #11
    SitePoint Member
    Join Date
    Sep 2012
    Location
    West Allis, Wisconsin, United States
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just double checked to see what it was and it's called "sql buddy" and it lets you import and export .sql files, I have to log in with the username and password I created for it, I can add other admins and everything.... so that means I already got what I need on there right?...

  12. #12
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,578
    Mentioned
    62 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by DaMighty Optiq View Post
    I saw that on this site yesterday and tried it... and I got this error

    Warning: ini_set() has been disabled for security reasons in /www/zxq.net/o/p/t/optiq-customtees/htdocs/storeadmin/connect_to_mysql.php on line 3

    and lines 1-3 is that code....

    It looks like your INI_set is working already.
    You could try echo INI_get("show_errors"); and it should return true or 1.

    You could also try setting error_reporting(0); and there should be no warning mesge displayed.

    It is hard wok ttrying to post a reply using one finger on this Nexus 7.


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
  •