Re: Re: [PHP] pass text variables to next page
| From: | Tim Streater | Date: | Tue, 09 Aug 2011 15:31:00 +0000 |
| Subject: | Re: Re: [PHP] pass text variables to next page | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-314450@lists.php.net to get a copy of this message | ||
On 09 Aug 2011 at 13:30, Chris Stinemetz <chrisstinemetz@gmail.com> wrote:
> Not sure if I am doing it right. It looks like the last single quote
> is being escaped.
>
> When I dump the query I get:
>
> SELECT store_id, store_subject FROM stores WHERE store_subject =
> 'Bella Roe 4980 Roe Blvd\'
>
>
> I am thinking maybe I have too many single quotes some where, but I
> can't find it.
>
> echo '<h4><a href="store.php?id=' .
> $storerow['store_subject'] . '">'
> .. $storerow['store_subject'] . '</a></h4> at ' .
> date('m-d-Y',
> strtotime($storerow['store_date']));
>
>
> The query:
>
> $sql = "SELECT store_id, store_subject
> FROM stores
> WHERE store_subject = '" .
> mysql_real_escape_string($_GET['id']."'");
Why don't you:
1) Make this a single line instead of splitting it over three. No need to do that.
2) Having created $sql, echo it out. That way you could see whether it's correct or not.
Doing (1) and (2) will make it a damn sight easier to see what you are *actually* creating.
--
Cheers -- Tim