newbie question on escaping strings
- From: howardk <howardck@xxxxxxxxx>
- Date: Thu, 29 Nov 2007 08:01:19 -0800 (PST)
I know this isn't a hard one, but it's making me slightly crazy. :-) I
have the following code that works just fine:
while( $row = mysql_fetch_array( $result ) ){
$id = $row['practcatid'];
$name = $row['practcatname'];
print "<option value='$id'> $name </option>\n";
}
What I'd like to be able to do however is use the two array
components, $row['practcatid'] and $row['practcatname'], in the final
print statement directly rather than dereferencing them to $row and
$name first. However, the string escaping is screwing me up. I need:
1 - a single or double quote to demarcate the entire string
2 - a single or double quote, escaped or otherwise, to demarcate the
ends of the attribute value, and
3 - a single quote (I think!), escaped or otherwise, to name the $row
array components.
Whatever it takes, I can't get it to work. Help!
TIA,
Howard
.
- Follow-Ups:
- Re: newbie question on escaping strings
- From: ZeldorBlat
- Re: newbie question on escaping strings
- Prev by Date: Re: [PHP] Curl doesn't handle memory stream
- Next by Date: Re: [PHP] Structured Code vs. Performance
- Previous by thread: One more data formatting question
- Next by thread: Re: newbie question on escaping strings
- Index(es):