Re: String variable

From: Date: Sun, 11 Jan 2009 14:07:42 +0000
Subject: Re: String variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-286018@lists.php.net to get a copy of this message
On Sun, Jan 11, 2009 at 8:59 AM, MikeP <mpeloso@princeton.edu> wrote: > Hello, > I am trying yo get THIS: > where ref_id = '1234' > from this. > $where="where ref_id="."'$Reference[$x][ref_id]'"; > > but i certainly have a quote problem. > > Any help? > Thanks > Mike > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Looks like you're missing the single tics around ref_id. In your example you'd want one of these: $where="where ref_id="."'{$Reference[$x]['ref_id']}"; $where="where ref_id="."$Reference[$x]['ref_id']; $where=sprintf("where ref_id=%d", (int)$Reference[$x]['ref_id']); <-- use this one or else! (sql injection)

« previous php.general (#286018) next »