Hi all,
I'm wondering if this is possible with PHP:
$query = "SELECT * FROM table WHERE afield='$someth ing'";
has quite a different meaning from
$query = 'SELECT * FROM table WHERE afield=\'$somet hing\'';
I'm trying to work out if it is possible to use the latter as a primitive
sort of data-binding (I know its not going to prevent injection). I would
create $query before the value of $something is finalised, then apply the
interpolation operation on $query to get it to substitute the variable at
that point.
Is there an easy way to do this with PHP?
TIA,
C.
I'm wondering if this is possible with PHP:
$query = "SELECT * FROM table WHERE afield='$someth ing'";
has quite a different meaning from
$query = 'SELECT * FROM table WHERE afield=\'$somet hing\'';
I'm trying to work out if it is possible to use the latter as a primitive
sort of data-binding (I know its not going to prevent injection). I would
create $query before the value of $something is finalised, then apply the
interpolation operation on $query to get it to substitute the variable at
that point.
Is there an easy way to do this with PHP?
TIA,
C.
Comment