Re: [PHP-DB] Escaping an '

2010-10-17 Thread Bastien
Mysql_real_escape_string($bar)

Bastien Koert
905-904-0334
Sent from my iPhone

On 2010-10-16, at 10:41 PM, "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?
> 

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



Re: [PHP-DB] Escaping Characters help needed

2005-09-23 Thread Micah Stevens

Just out of curiosity, your method looks like it should work, what's the mysql 
error message?

-Micah 

On Friday 23 September 2005 2:28 pm, Chris Payne wrote:
> Hi there everyone,
>
> Can any of you see why the below will not insert into my database?
>
> Hann Heritage Homes' Fall Circuit entry. Fabulous ranch floorplan w/walkout
> basement. Stunning great room w/FP, dramatic dining room, den, screened
> porch. Mullett kitchen with glazed birch cabinets and granite. Luxury
> master BR and bath. The finest materials and workmanship throughout.
> Interiors by Pine Tree Barn. Compare and you'll choose to build with Hann
> Heritage Homes!
>
>
>
> I'm using PHP with MySQL and I store the data in $marketremarks but when it
> gets to THIS FIELD with this particular data in it, it just won't insert. 
> I use the below to escape the characters, but I'm missing something or
> doing something wrong?
>
> addslashes(trim($marketremarks));
>
> Any help would REALLY be appreciated.
>
> Thanks everyone,
>
> Chris
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.2/105 - Release Date: 9/19/2005

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



Re: [PHP-DB] Escaping Characters help needed

2005-09-23 Thread Micah Stevens

look at:

mysql_escape_string();


On Friday 23 September 2005 2:28 pm, Chris Payne wrote:
> Hi there everyone,
>
> Can any of you see why the below will not insert into my database?
>
> Hann Heritage Homes' Fall Circuit entry. Fabulous ranch floorplan w/walkout
> basement. Stunning great room w/FP, dramatic dining room, den, screened
> porch. Mullett kitchen with glazed birch cabinets and granite. Luxury
> master BR and bath. The finest materials and workmanship throughout.
> Interiors by Pine Tree Barn. Compare and you'll choose to build with Hann
> Heritage Homes!
>
>
>
> I'm using PHP with MySQL and I store the data in $marketremarks but when it
> gets to THIS FIELD with this particular data in it, it just won't insert. 
> I use the below to escape the characters, but I'm missing something or
> doing something wrong?
>
> addslashes(trim($marketremarks));
>
> Any help would REALLY be appreciated.
>
> Thanks everyone,
>
> Chris
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.2/105 - Release Date: 9/19/2005

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



RE: [PHP-DB] escaping line brakes

2002-07-16 Thread joakim . andersson

> From: Andy [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 16, 2002 2:45 PM

> 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?

When did you use nl2br() (which I assume you mean)? Before you store the the
data in the database or when you retrive it?

If before then use echo str_replace("", "\n", $your_string)
If when you retrieve the data for output to the form, then just don't use
nl2br().

Regards
Joakim Andersson

> 
> Thanx for any help,
> 
> Andy

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




Re: [PHP-DB] Escaping queries in php using InterBase

2001-08-22 Thread Yves Glodt

On Wednesday 22 August 2001 14:34, Patrik Wallstrom wrote:
> On Wed, 22 Aug 2001, Yves Glodt wrote:
> > Hello,
> >
> > I'm in trouble with my current project which uses Interbase as
> > backend. (php.ini: magic_quotes_sybase = On)
> > When I insert a string containing a ', like Beverly D'Angelo,
> > php saves it with two '
> > When I insert it with two ', it gets saved with four '
>
> [...]
>
> I have always wondered why there is no mysql specifig quoting
> functions in php. Here is what I use:
>
> function myslashes($content = "") {
> $content = str_replace("\\","",$content);
> $content = str_replace("'","\\'",$content);
> return $content;
> }
>
> I guess Interbase also uses backslash for quoting?

Unforunately not!
You must use ' for escaping.
But now rethinking, some str_replace("''","'",$var); before displaying 
the string should do it.

thank you,

yves


--
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]




Re: [PHP-DB] Escaping queries in php using InterBase

2001-08-22 Thread Patrik Wallstrom

On Wed, 22 Aug 2001, Yves Glodt wrote:

> Hello,
>
> I'm in trouble with my current project which uses Interbase as backend.
> (php.ini: magic_quotes_sybase = On)
> When I insert a string containing a ', like Beverly D'Angelo,
> php saves it with two '
> When I insert it with two ', it gets saved with four '

[...]

I have always wondered why there is no mysql specifig quoting functions in
php. Here is what I use:

function myslashes($content = "") {
$content = str_replace("\\","",$content);
$content = str_replace("'","\\'",$content);
return $content;
}

I guess Interbase also uses backslash for quoting?

--
 patrik wallstrom |  f o o d f i g h t
 tel: +46-8-6188428   |  s t o c k h o l m
 gsm: +46-709580442   |  - - - - - - - - -


-- 
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]