Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-03-2009, 11:51 PM   #1
Socks
Confirmed User
 
Industry Role:
Join Date: May 2002
Location: Toronto
Posts: 8,475
MySQL easy syntax question

update category_text set text='this is a problem because it's got an apostrophe in it', keywords='asdf,asdf' where id='1';

Just that the string I want to insert has an apostrophe.. Is that going to mess the syntax up?
Socks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2009, 12:14 AM   #2
jMEGA
Confirmed User
 
Join Date: Oct 2005
Location: St. Louis, MO
Posts: 671
try this

update category_text set text='this is a problem because it\'s got an apostrophe in it', keywords='asdf,asdf' where id='1';
__________________
Design | SEO | Photo / Video Editing
( ICQ 49354667 )
jMEGA is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2009, 12:53 AM   #3
Socks
Confirmed User
 
Industry Role:
Join Date: May 2002
Location: Toronto
Posts: 8,475
Nice thanks!! Now I know why I've seen those things printed around my site sometimes heh
Socks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2009, 01:52 AM   #4
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,428
google for php html entities
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2009, 08:01 AM   #5
nation-x
Confirmed User
 
nation-x's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
if this is for a php script then you can just use http://us3.php.net/mysql_real_escape_string

Code:
$sql = "update category_text set text='".mysql_real_escape_string("this is a problem because it's got an apostrophe in it")."', keywords='asdf,asdf' where id='1';"

$affected_rows = mysql_query($sql);

Last edited by nation-x; 04-04-2009 at 08:03 AM..
nation-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.