Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

SQLite - PDO - double quotes escaped

Codes here !

Moderators: macek, egami, gesf

SQLite - PDO - double quotes escaped

Postby chat94 » Fri May 25, 2012 8:15 am

Hello,

I'm trying SQLite 3 with PDO (i only know MySQL).

I have a field with this value :
...parler de "famille de produit"...

When i do a select request to retrieve these datas, i obtain :
$cnx->query("SELECT * FROM diffuseur_champs WHERE id_diffuseur=".$_POST['diffuseur']." ORDER BY ordre")->fetchAll()
...parler de \"famille de produit\"...

How can i have this result without \ ?

Thanks
chat94
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri May 25, 2012 8:09 am

Re: SQLite - PDO - double quotes escaped

Postby Nullsig » Fri May 25, 2012 8:26 am

By not inserting it into the database with the slashes.

By ensuring that magic quotes is turned off

By using stripslashes() function.
User avatar
Nullsig
php-forum Fan User
php-forum Fan User
 
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: SQLite - PDO - double quotes escaped

Postby chat94 » Fri May 25, 2012 8:50 am

Ok thanks,

PHP (5.3.6) is by default with magic_quotes_gpc to 1.

Is best to put it at 0 or to use stripslashes() function on GPC datas ?
chat94
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri May 25, 2012 8:09 am

Re: SQLite - PDO - double quotes escaped

Postby Nullsig » Fri May 25, 2012 10:04 am

Magic quotes and global variables should be disabled.
User avatar
Nullsig
php-forum Fan User
php-forum Fan User
 
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.