Jump to content

[SOLVED] INSERT and escaping characters


Lodius2000

Recommended Posts

So i am designing a simple blog cms and i have gotten to where I can insert values into my table and pull them back out,

 

my question is when I submit a value like

 

I've been thinking

 

to a varchar or text field it automatically escapes the ' making the string read I\'ve been thinking

 

problem is when I go to pull it back from the database, out to php, it still prints the escape \.

 

question 1.

 

is there a php or mysql function that would convert those back into their correct characters upon SELECTion,

 

though it reads wrong it is a minor annoyance in text but is wreaking havoc on file paths for <img> and <embed> tags

 

ie

 

<embed src=\"/video/052108laugher.mov\" height=\"256\" width=\"320\" autoplay=\"false\" type=\"video/quicktime\" pluginspage=\"http://www.apple.com/quicktime/download/\">

 

should be

 

<embed src="/video/052108laugher.mov" height="256" width="320" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/">

 

question 2

which brings up the second part of the question, does this magical php or mysql function leave < and > intact so that my entries can have html embedded in them, i know htmlentities wont help for that but I hope there is a way

 

if there is not a function, and it is much more complicated, a little nudge in the right direction to research would be appreciated

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/108909-solved-insert-and-escaping-characters/
Share on other sites

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.