Jump to content

Stripslashes or AddSlashes?


stublackett

Recommended Posts

I posted yesterday about this,

 

I thought I had the solution but it seems I havent

 

I was reccomended to set an Array for addslashes to my script

 

I've tried it on a different Script and when it inserts into the Database all it inserts is the word "Array" Nothing else ???

 

My code is as follows :

 

<?php
if (!empty($_POST['info'])) {
	$info = Array("1",addslashes(nl2br($_POST['info'])));
}else{
	$info = NULL;
	$errors['info'] = '<p><font color="red">You need to enter info for this directory item</font></p>';
}
?>

 

Whats the best way to incorporate Addslashes or Stripslashes?

Link to comment
https://forums.phpfreaks.com/topic/117494-stripslashes-or-addslashes/
Share on other sites

I was reccomended to set an Array for addslashes to my script

 

I've tried it on a different Script and when it inserts into the Database all it inserts is the word "Array" Nothing else ???

 

If its only inserting "Array" then the addslashes function was not needed for that particular $_POST.

 

In other words. Its working fine. Its a good thing that its inserting "Array", addslashes is for security for $_POST's and other types of data.

I think, I've sorted it........

 

But the previous post was : http://www.phpfreaks.com/forums/index.php/topic,209419.msg952127.html#msg952127

 

I really need to know the best way to represent data that has apostrophes slashes etc in it, As I'm getting an SQL Syntax Error everytime

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.