[SOLVED] query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

[SOLVED] query

Post 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' 
?>
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Use addslashes() and it'll autmatically convert all ' to \'
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

cheers anjanesh, worked wonders
Post Reply