Re: Using variables within a SELECT statement

From: Date: Wed, 28 Nov 2001 14:46:51 +0000
Subject: Re: Using variables within a SELECT statement
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-14652@lists.php.net to get a copy of this message
Try, $query="select * from my_contacts where contactid like '$cir'"; Kevin Ruiz wrote: > > I'm working on an application that selects a user's userid if their password > and login match. If the login and password match I want my variable $cir to > run its own select statement and return its corresponding contactid...for > this example we'll say that value = 5. I then want to plug in $cir into my > select statement that will show the user the list of his/her contacts and > only theirs. This seems to be the select statement that's giving my > problems. > > $query = "select * from my_contacts where > contactid=$cir"; > > Whenever I run my script I get an error saying that I have a problem with my > sql syntax. I know that the problem is with the variable becuase it runs > fine with a value in it. > > I've tried writing the $cir as '$cir' and '\$cir' but nothing seems to > work. > > Can anyone help. > > Thanks in advance > Kevin > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Sliante, Richard S. Crawford mailto:rscrawford@mossroot.com http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: underpope@hotmail.com "When you have lost the ability to laugh at yourself, you have lost the ability to think straight." --Clarence Darrow "Push the button, Max!"

« previous php.db (#14652) next »