A Function Problem

Discussion in 'PHP' started by belthazar, Apr 20, 2006.

  1. #1
    Hey Guys.. Im trying to use the function mysql_real_escape_string() but all i get is this error message. what did I do wrong? i have included the code snippet in which I used the function.

    Fatal error: Call to undefined function: mysql_real_escape_string() in /var/www/html/xuonline/test/qb/create-blog.php on line 59

    Code:
    if ( isset($_POST['create']) ) { // process form
    $blog_name = $_POST['blog_name'];
    $blog_desc = $_POST['blog_desc'];

    $blog_name = strtolower(trim($blog_name));
    $blog_desc = mysql_real_escape_string(trim($blog_desc));
     
    belthazar, Apr 20, 2006 IP
  2. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is it on a local or remote server?

    mysql_real_escape_string was added fairly recently to PHP... version 4.3.0 (hey, that seems to be recent when it comes to servers and PHP!). Are you sure that the server is that up to date?
     
    TwistMyArm, Apr 20, 2006 IP
  3. belthazar

    belthazar Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    actually i don't know, can I view the version on the telnet console?
     
    belthazar, Apr 20, 2006 IP
  4. kjewat

    kjewat Active Member

    Messages:
    149
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Create this small php script and run it, and you'll get lots of information about php...

    <?php phpinfo(); ?>
    PHP:
     
    kjewat, Apr 21, 2006 IP
  5. drewbe121212

    drewbe121212 Well-Known Member

    Messages:
    733
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    125
    #5
    Yeah, that mysql function was added in a later version. Let us know what version you are running to compare it! If it is an issue, talk with your webhost about upgrading PHP to the next best thing; 5.0 :)
     
    drewbe121212, Apr 21, 2006 IP
  6. belthazar

    belthazar Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    the phpinfo() function displayed:
    MySQL -> 3.23.58
    PHP -> 4.2.2

    That explained it. so the function is new and our PHP is old..! Shi*
    tnx guys, i'll inform that useless Net. Ad. of ours!
     
    belthazar, Apr 21, 2006 IP