Re: quoting pains

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Patrick Fleming, EA
Date:  
To: plug-discuss
Subject: Re: quoting pains


Craig White wrote:
> I have a problem with quoting strings
>
> My problem is with php/mysql but I would venture to guess that this
> issue is almost across the board problem and not specific to this pair.
>
> My string...
> (php)
> $my_search = "SELECT * from horde_datatree WHERE user_uid = \"$user\" \
> AND (group_uid = 'horde.shares.kronolith' OR group_uid = \
> 'horde.shares.nag' OR gr\oup_uid = 'horde.shares.imp' OR group_uid = \
> 'horde.shares.turba' OR group_uid = 'horde.shares.mnemo')";
>



$my_search ="SELECT * from horde_datatree where user_uid = '$user' AND
<snip>


> which results in (an example - variable expanded)
>
> SELECT * from horde_datatree WHERE user_uid = "jennifer" AND (group_uid
> = 'horde.shares.kronolith' OR group_uid = 'horde.shares.nag' OR
> group_uid = 'horde.shares.imp' OR group_uid = 'horde.shares.turba' OR
> group_uid = 'horde.shares.mnemo')
>
> now I need to pass this string (along with other things) in an html POST
> operation...
>
> echo "<input type='hidden' name='search_string' \
> value=\"$search_string\">";


echo "<input type=\"hidden\" name=\"search_string" \
value=\"$search_string\">";

Not sure if it matters but I see that you are mixing quotation marks.
I did notice that you are using $my_search above and $search_string here.

I guess one other question that I might have is why are you passing the
whole query instead of just the user_uid string?
That way you check to see if user_uid is set, and if so load it into the
query.


---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss