Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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