How to escape quote when retrieving record from database?

I add records to my database using $wpdb like this:

$title = 'test url';
$content = '<a href="#">test</a>'
$wpdb->insert($db_name, array(
   "title" => $title,
   "content" => $content
), '%s');

when i check database i see that content is take the backslash escaping quotes like this: <a href="#">test</a>

Read More

i have tried to get record from database with stripcslashes() but dosnt work.

Is there a way to do so and garding the security reason?

Related posts

2 comments

  1. Please get the record from the database and pass it to this function

    $without_slashes = stripslashes($row['coln']);
    
  2. Try this

    $title = 'test url';
    $content = "'<a href="#">test</a>'"
    $wpdb->insert($db_name, array(
       "title" => $title,
       "content" => $content
    ), '%s');
    

Comments are closed.