RE: [PHP-DB] Names with apostrophe's

2004-09-29 Thread Hutchins, Richard
urlencode() or one of the related functions?

Not sure, but the docs looked reassuring.


> -Original Message-
> From: Craig Hoffman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 29, 2004 2:23 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Names with apostrophe's 
> 
> 
> Hello,
> I could use some help here.  I have an entry in the MySQL, 
> that use an  
> apostrophe,  for example lets call it "O'Reilly".  I have added  
> addslashes to my insert statement so MySQL accepts it with out  
> complaining.
> 
> The problem I am having is I use this information "O'Reilly" 
> in a GET  
> URL somewhere else in the site.
> For example here's my link:
> echo(" href='user_book_results_detail.php?book=$row[book]>$row[book] td>");
> 
> When I mouse over and view the URL, PHP thinks the apostrophe 
> (single  
> quote) is the end and quits.   I know I need to include a 
> back slash or  
> escape this character  but I am not entirely sure how I do it?
> Suggestions?
> 
> Sample URL:
> http://user_book_results_detail.php?book=O
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] Names with apostrophe's

2004-09-29 Thread Matt M.
> echo(" href='user_book_results_detail.php?book=$row[book]>$row[book] td>");

http://us4.php.net/urlencode

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



RE: [PHP-DB] Names with apostrophe's

2004-09-29 Thread Gryffyn, Trevor
Try:

Echo "$row[book]\";

I'm dubious on the $row[book] bit took, maybe you meant $row["book"] or
$row[$book].

Anyway, you didn't have a closing quote on the HREF, you don't need the
( and ) on the echo, you used the ' instead of " for the HREF (which is
probably allowed but I don't like it myself).

As for apostrophes, you should be able to escape them with \'

If you use ' to start an echo or href, then another ' is going to close
it.  If you use " to open an echo or href, then the ' should go through
ok, or maybe require a \' but should still be ok.

When you insert apostrophes into a database, use '' to escape it (I
believe that works in MySQL as well as other DBs), don't use \' when
inserting into a DB.

Your question is a little cloudy, but maybe that helped clarify a few
things for you.

-TG

> -Original Message-
> From: Craig Hoffman [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 29, 2004 2:23 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Names with apostrophe's 
> 
> 
> Hello,
> I could use some help here.  I have an entry in the MySQL, 
> that use an  
> apostrophe,  for example lets call it "O'Reilly".  I have added  
> addslashes to my insert statement so MySQL accepts it with out  
> complaining.
> 
> The problem I am having is I use this information "O'Reilly" 
> in a GET  
> URL somewhere else in the site.
> For example here's my link:
> echo(" href='user_book_results_detail.php?book=$row[book]>$row[book] td>");
> 
> When I mouse over and view the URL, PHP thinks the apostrophe 
> (single  
> quote) is the end and quits.   I know I need to include a 
> back slash or  
> escape this character  but I am not entirely sure how I do it?
> Suggestions?
> 
> Sample URL:
> http://user_book_results_detail.php?book=O
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] Names with apostrophe's

2004-09-29 Thread GH
You need to use the urlencode() function



On Wed, 29 Sep 2004 13:23:07 -0500, Craig Hoffman <[EMAIL PROTECTED]> wrote:
> Hello,
> I could use some help here.  I have an entry in the MySQL, that use an
> apostrophe,  for example lets call it "O'Reilly".  I have added
> addslashes to my insert statement so MySQL accepts it with out
> complaining.
> 
> The problem I am having is I use this information "O'Reilly" in a GET
> URL somewhere else in the site.
> For example here's my link:
> echo(" href='user_book_results_detail.php?book=$row[book]>$row[book] td>");
> 
> When I mouse over and view the URL, PHP thinks the apostrophe (single
> quote) is the end and quits.   I know I need to include a back slash or
> escape this character  but I am not entirely sure how I do it?
> Suggestions?
> 
> Sample URL:
> http://user_book_results_detail.php?book=O
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



Re: [PHP-DB] Names with apostrophe's

2004-09-30 Thread Craig Hoffman
Thanks everyone.
urlencode worked like a charm.
On Sep 29, 2004, at 3:53 PM, GH wrote:
You need to use the urlencode() function

On Wed, 29 Sep 2004 13:23:07 -0500, Craig Hoffman 
<[EMAIL PROTECTED]> wrote:
Hello,
I could use some help here.  I have an entry in the MySQL, that use an
apostrophe,  for example lets call it "O'Reilly".  I have added
addslashes to my insert statement so MySQL accepts it with out
complaining.
The problem I am having is I use this information "O'Reilly" in a GET
URL somewhere else in the site.
For example here's my link:
echo("