Page 1 of 1

[SOLVED] query

Posted: Tue Apr 12, 2005 5:34 am
by gurjit
Hi all,

I pass variables to a query which can have a ' in them depending what the user has entered. How can i make the query escape the ' in the query.

Code: Select all

<?php
select mhvid from tbl_master_ho_invoice where mhv_location = 'Helen's Kingdom' 
?>

Posted: Tue Apr 12, 2005 6:46 am
by anjanesh
Use addslashes() and it'll autmatically convert all ' to \'

Posted: Tue Apr 12, 2005 6:51 am
by gurjit
cheers anjanesh, worked wonders