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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Database Connectin with an Include

    I have used the following statement to connect to my database, and when I run a debug I am getting the following error:

    Fatal Error: Call to undefined function mysql_connect() in c:/www.....
    This is how it shows in the various files:

    Code:
    <?php
    include_once "myconnect.php";
    /* WorkOrder.php */
    ?>
    The wierd thing is that even though I get the fatal error, the connection to the database still works and the data is uploaded to the database.

    I am getting this error on every screen that has this include.

    Here is the info in the file myconnect.php
    Code:
    <?php
    
    // YOU NEED TO CHANGE THE CONTENTS OF THE values of variables given in single quotes
    
    //CONFIGURATION SECTION STARTS ///
    
    $servername='localhost' ;  // Replace this 'localhost' with your server name
    $database_username='root'; // Replace this  with your username
    $database_password='';  // Replace this  with your password
    $database_name='ge';  // Replace this 'db' with your database name
    
    // CONFIGURATION SECTION ENDS ////
    
    
    
    mysql_connect($servername,$database_username,$database_password);
    mysql_select_db($database_name)or die(mysql_error());
    ?>

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    I got that error message when I installed phorum 5.1.15 with PHP 4.2.3, the forum required PHP 4.3 or higher. Below is the db connect code I use, one improvement would be to move the db_connect.php out of the route directory.

    PHP Code:
    <?php
    include "db_connect.php";
    ?>
    db_connect.php
    PHP Code:
    <?php
    define 
    ('DB_USER''');
    define ('DB_PASSWORD''');
    define ('DB_HOST''localhost');
    define ('DB_NAME''store');

    $dbc mysql_connect (DB_HOSTDB_USERDB_PASSWORD);
    mysql_select_db (DB_NAME);
    ?>
    Last edited by Len Whistler; 08-17-2006 at 05:43 AM.
    Leonard Whistler

  • #3
    Regular Coder
    Join Date
    Jul 2006
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the tip, I will have to see if I can figure out what isn't working together......

    What do you mean by move it out of the route directory, and why do you suggest that? Is this a security issue?

    Ken

  • #4
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    anybody knows name of that script? ^^ ?


  •  

    Posting Permissions

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