Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

golazo on "Error mysql_real_escape_string() in wordpress"

$
0
0

I have next code for create account and insert post in database. Problem is, when i logged an i try to submit new post, apear this error:

Warning: mysql_real_escape_string() expects parameter 1 to be string, object given in....

Why?

/* Create acount */

    if (isset($_POST['task']) && $_POST['task'] == 'register')
    {
    $parola_user = $wpdb->escape(trim($_POST['psw']));
    $email_anunt = $wpdb->escape(trim($_POST['email']));

    if (email_exists($email))
    {
    $err = "Adressa exist";
    }
      else
    {
    $user_id = wp_insert_user(array(
    'user_pass' => apply_filters('pre_user_user_pass', $psw) ,
    'user_login' => apply_filters('pre_user_user_login', $email) ,
    'user_email' => apply_filters('pre_user_user_email', $email) ,
    'role' => 'author'
    ));
    }
    }

....

/* Insert post */

$date = array(
    'post_title' => $title,
    'post_content' => $desc,
    'post_status' => 'publish',
    'post_category' => array(
        $categ
    ) ,
    'post_author' => $user_id,
);

$post_id = wp_insert_post($date);

Viewing all articles
Browse latest Browse all 8245

Trending Articles