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
    New Coder
    Join Date
    Mar 2004
    Posts
    95
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Moved my pages and now I get errors

    Hi,

    I was testing some pages I was writing on my own site and mysql database before moving it to the final site. They work fine on my site but now that I have moved it and transfer the sql over I am getting some errors.

    PHP Code:
    // Function for escaping and trimming form data.
    function escape_data ($data) {
            global 
    $dbc// Need the connection.
            
    if (ini_get('magic_quotes_gpc')) {
                    
    $data stripslashes($data);
            }
            return 
    mysql_real_escape_string (trim ($data), $dbc);
    // End of function. 
    This function is in the page with all the database connection information, mysql_connect.php

    I am getting this error when my page tries to add or update to the database.

    Fatal error: Call to undefined function: mysql_real_escape_string() in /home/share/website.net/www.websitei.net/public_html/mysql_connect.php on line 41

    Hopefully someone can tell me why this happens.

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Have you moved to a different server? You may be using a different php version?

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    95
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Yes, it has moved to a different server. As I am a newbie ... how can I work around this?

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Not sure really, might be something for you in the manual http://uk.php.net/mysql_real_escape_string
    Just been thinking (yeah, it's a rare thing I do ) maybe you could use str_replace to put a backslash infront of special characters?
    Last edited by Nightfire; 03-23-2004 at 02:00 AM.


  •  

    Posting Permissions

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