[PHP-DB] Re: Escaping an '

2010-10-16 Thread David Robley
Ron Piggott wrote:

 For a query similar to:
 
 SELECT * FROM `tablle` WHERE `column` LIKE 'Sally's Hair Parlor'
 
 how do I escape the ' for 's?

It's in the manual - assuming you use mysql, see
http://php.net/manual/en/book.mysql.php


Cheers
-- 
David Robley

I just won 1000 dollars, Tom said grandly.
Today is Setting Orange, the 71st day of Bureaucracy in the YOLD 3176. 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: escaping line brakes

2002-07-16 Thread David Robley

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
says...
 Hi there,
 
 I am putting text into a mysql db from a form field. I do include the
 linebrakes with line2br.
 
 Now I would like to create an interface where I could load the text into the
 form again to edit it. Unfortunatelly it includes some wired chars like \br
 into the text. How can I get rid of that?
 
 Thanx for any help,
 
 Andy

It sounds like you are using nl2br to all breaks _before_ you insert your 
data into a table. Don't do this, for this very reason.

Only use nl2br _after_ you extract the data to format it for display in a 
browser; you don't need to use nl2br to display the data in a TEXTAREA 
of course.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: Escaping

2001-07-12 Thread David Bullock

On Thu, 12 Jul 2001 10:18:23 -0500, [EMAIL PROTECTED] (Randy Rankin)
wrote:

Hello,

I have a table in a MySQL DB (RH Linux/Apache) with a field called
customer_name. Some of the customer names have an ampersand in them (ie; X 
X Supply). I am performing a select statement on this table to create a
sales summary with customer name and total sales.

This works fine; however, I am also creating a dynamic link on the customer
name so that the user can click on it to get a detailed report of sales to
that customer. This works great EXCEPT for the customers with ampersands in
thier names. The result of clicking on these customers indicates a No
Records found for X where X is the letter immediately preceding the
ampersand.

Does anyone know how to get around this?

Would it be practical to link off a unique record_id instead of the noun-name? 

That way you can assure that the data you're passing doesn't have any
URL-unfriendly characters, and you guarantee that the data you're retrieving is
the unique data you're linking from.

Dave

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]