GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  PHP
Go To First  |  Previous Question  |  Next Question 
 PHP  |  Question 20 of 74    Print  
How do you insert single & double qotes in MySql db without using PHP?

  
Total Answers and Comments: 7 Last Update: September 18, 2008     Asked by: Lokesh M 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Mohamed Yusuf
 
escape single quote using forward slash ' .in double quote you don't need to escape quotes. insert as it ""

Above answer was rated as good by the following members:
prasad_konnur
October 11, 2006 18:38:23   #1  
Henry        

RE: How do you insert single & double qotes in MySql d...
& / "e;
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 2Overall Rating: -2    
October 26, 2006 03:23:09   #2  
vinit sharma        

RE: How do you insert single & double qotes in MySql d...
the new fool prrof method isto use PEAR and in that use prepare() execute method or auto execute method . this takes care of mot just quotes but all the html characters to be stored i the db .
 
Is this answer useful? Yes | No
December 13, 2006 12:16:32   #3  
Mohamed Yusuf        

RE: How do you insert single & double qotes in MySql d...
escape single quote using forward slash ' .in double quote you don't need to escape quotes. insert as it
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
February 08, 2007 01:05:55   #4  
riskyyip Member Since: February 2007   Contribution: 1    

RE: How do you insert single & double qotes in MySql d...
there are 2 method:1. use escape back slash: or '2. use or '' in the quoted string e.g. ' it''s good' stands for : it's good in the table.
 
Is this answer useful? Yes | No
July 28, 2008 05:01:11   #5  
akhilesh1010 Member Since: July 2008   Contribution: 4    

RE: How do you insert single & double qotes in MySql db without using PHP?
we can use addslashes function for this


 
Is this answer useful? Yes | No
August 14, 2008 09:26:38   #6  
EllisGL Member Since: August 2008   Contribution: 1    

RE: How do you insert single & double qotes in MySql db without using PHP?
The way the question is formed - you would either:
1.) Use the MySQL CLI to perform an INSERT: INSERT INTO `myDB` (`col1` `col2`) VALUES ('It's the best!' '"Mike" says hi!');

2.) Use another language other than PHP.

 
Is this answer useful? Yes | No
September 18, 2008 13:15:24   #7  
jigishpthakar Member Since: September 2008   Contribution: 1    

RE: How do you insert single & double qotes in MySql db without using PHP?
While embeding varible to query string use PHP function addslashes()
this will solve the problem of any special character.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape