FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » Database discussions » Insert html content as a value into mysql database?
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Insert html content as a value into mysql database? [message #168258] Mon, 25 March 2013 00:13 Go to next message
Jack Hard is currently offline  Jack Hard
Messages: 7
Registered: December 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user


can someone please help, i am wanting to insert some html text WITH LINE BREAKS into the database as a value, but when i add in line breaks it causes the query to fail, i think this is becuase mysql doesnt support html line breaks

can someone show me a way i can keep my text structure with line breaks and get the query working thanks.

the value that's giving me trouble is the 'content'.

$query="INSERT INTO ptb_messages (id,
from_user_id, to_user_id, subject, content)
VALUES('NULL',
'1',
'".$_SESSION['user_id']."',
'Welcome...',
'Hi There Very Happy,<br/><br/>
Welcome to your brand new, sparkling profile. We're so excited to have you with us! We just wanted to check in on you to see how you were getting on, and to let you know that if you have any questions or comments for us then please do not hesitate to get in touch at Support(at)fixstructure(dot)com.<br/><br/>
fixstructure.com is a fun, friendly and clean community, please help us keep it this way. We want you to enjoy your new profile to the maximum but there are a few do's and dont's, for more information checkout our Terms and User Policy under the help link in your Account Settings menu.<br/><br/>
That's pretty much everything, so thanks once again for joining the fixstructure.com community and we look forward to seeing more of you and watching your new profile grow in the future.<br/><br/>Regards,<br/>The fixstructure Team'
)";
mysql_query($query) or die('error');
Re: Insert html content as a value into mysql database? [message #168304 is a reply to message #168258] Sun, 14 April 2013 03:24 Go to previous message
naudefj is currently offline  naudefj   
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
You need to escape all quotes.
For example: We\'re so excited...
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: HY000: database is locked
Next Topic: MYSQL database slave support
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Oct 17 16:44:19 EDT 2017

Total time taken to generate the page: 0.00738 seconds