Jump to content

Problem with 'mysqli_real_escape_string()'


malma

Recommended Posts

I'm using php 5.5.12, this vassion doesn't have "magic_quotes_gpc" in it but i'm trying to put the codes anyway.

The problem is that I'm getting an error

 

Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C:\wamp\www\widget\includes\functions.php on line 16

 

Here are my codes.

    function mysqli_prep($value) {

    $magic_quotes_active = get_magic_quotes_gpc();

    $new_enough_php = function_exists("mysqli_real_escape_string");

     // i.e PHP >= v4.3.0

     if ($new_enough_php) {// PP v4.3.0 or higher

     //undo any magic quotes effects so mysqli_real_escape_string
     
     if( $magic_quotes_active) {$value = stripslashes($value);}


     $value = mysqli_real_escape_string( $value );


     } else {// before PHP v4.3.0 

     // if magic quotes aren't already on then add slashes manually

     if (!$magic_quotes_active) {$value = addslashes($value);}

     // if magic quotes are active, then the slashes already exist

     }  
     return $value; 
    }
    function redirect_to($location) {

        if($location) {

            header("Location: {$location}");

            exit;
    }
    }

Please go through my codes and tell me what is wrong

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.