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 8 of 8

Thread: php errors

  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Location
    Halifax .NS.Canada
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Exclamation php errors

    Just a simple login and reg page but for some reason i get this error on every page.
    Fatal error: Call to undefined function mysql_select_() in /home/a******/public_html/dbConfig.php
    been over the coding several times still no luck so i figured i would seek out help.
    if access is needed to the whole code and pages i am willing to give it i am just looking to know why it wont work thank you in advance.

  • #2
    jzo
    jzo is offline
    New Coder
    Join Date
    Oct 2011
    Location
    Boston
    Posts
    72
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Crickets View Post
    Just a simple login and reg page but for some reason i get this error on every page.
    Fatal error: Call to undefined function mysql_select_() in /home/a******/public_html/dbConfig.php
    been over the coding several times still no luck so i figured i would seek out help.
    if access is needed to the whole code and pages i am willing to give it i am just looking to know why it wont work thank you in advance.
    code is always help, what are you trying to select? a database? a table?

  • Users who have thanked jzo for this post:

    Crickets (10-26-2011)

  • #3
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,453
    Thanks
    71
    Thanked 102 Times in 101 Posts
    Post the code for dbConfig.php (remove your password from it).

    Sounds like mysql_query or mysql_fetch_array
    Been a sign maker for 7 years. My business:
    American Made Signs

  • Users who have thanked myfayt for this post:

    Crickets (10-26-2011)

  • #4
    New to the CF scene
    Join Date
    Oct 2011
    Location
    Halifax .NS.Canada
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by myfayt View Post
    Post the code for dbConfig.php (remove your password from it).

    Sounds like mysql_query or mysql_fetch_array
    here is the code the code in orange is what i believe to be the issue and it is supposed to be pulling from a database


    <?

    // Replace the variable values below

    // with your specific database information.

    $host = "mysql12.***************";

    $user = "a6533539_admin1";

    $pass = "";

    $db = "a6533539_admin";

    // This part sets up the connection to the

    // database (so you don't need to reopen the connection

    // again on the same page).

    $ms = mysql_pconnect($host, $user, $pass);

    if ( !$ms )

    {

    echo "Error connecting to database.\n";

    }

    // Then you need to make sure the database you want

    // is selected.

    mysql_select_($a6533539_admin);


    ?>
    Last edited by Crickets; 10-26-2011 at 08:38 PM. Reason: mistype

  • #5
    jzo
    jzo is offline
    New Coder
    Join Date
    Oct 2011
    Location
    Boston
    Posts
    72
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Crickets View Post
    here is the code the code in orange is what i believe to be the issue and it is supposed to be pulling from a database


    <?

    // Replace the variable values below

    // with your specific database information.

    $host = "mysql12.***************";

    $user = "a6533539_admin1";

    $pass = "";

    $db = "a6533539_admin";

    // This part sets up the connection to the

    // database (so you don't need to reopen the connection

    // again on the same page).

    $ms = mysql_pconnect($host, $user, $pass);

    if ( !$ms )

    {

    echo "Error connecting to database.\n";

    }

    // Then you need to make sure the database you want

    // is selected.

    mysql_select_($a6533539_admin);


    ?>
    mysql_select_db($db); is what you want i believe, since it seems you are trying to select a database.

    refer to http://php.net/manual/en/function.mysql-select-db.php

  • Users who have thanked jzo for this post:

    Crickets (10-26-2011)

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    As the error says, there is no such function mysql_select_. That should probably be mysql_select_db which is a function provided by the mysql extension.
    The variable itself is invalid though, that will trigger an undefined variable warning. That should either be hardcoded as that string, or since there is a variable set up you should be using $db.

  • #7
    New to the CF scene
    Join Date
    Oct 2011
    Location
    Halifax .NS.Canada
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    As the error says, there is no such function mysql_select_. That should probably be mysql_select_db which is a function provided by the mysql extension.
    The variable itself is invalid though, that will trigger an undefined variable warning. That should either be hardcoded as that string, or since there is a variable set up you should be using $db.
    thank you so much for the help its working now ty again.

  • #8
    jzo
    jzo is offline
    New Coder
    Join Date
    Oct 2011
    Location
    Boston
    Posts
    72
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Crickets View Post
    thank you so much for the help its working now ty again.
    to make things easier on you, you should create a db_connect function that you can call, it will make your code a little easier on the eyes probably.

    Code:
    function makeDBConnection()
    {
      $connection = mysql_connect( 'HOST', 'DATABASE', 'PASSWORD' );
      if ( !$connection ) exit( "can't connect!" );
      if ( !mysql_select_db( 'DATABASE', $connection ) ) exit( "can't select database!" );
    }


  •  

    Tags for this Thread

    Posting Permissions

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