RE: [PHP-WIN] Quoted Dynamic Strings are killing me (Second Attem pt)

From: Date: Mon, 22 Apr 2002 14:47:06 +0000
Subject: RE: [PHP-WIN] Quoted Dynamic Strings are killing me (Second Attem pt)
Groups: php.windows 
Request: Send a blank email to php-windows+get-13226@lists.php.net to get a copy of this message
Hey Ron, I just echoed your $query string just like you have it and I get the quotes around the values. I put this in a file: $selectedLastname = "smith"; $selectedFirstname = "jimmy"; $selectedMarket = "test"; $query = "select bio FROM individual WHERE last_name ='". $selectedLastname ."' AND first_name ='". $selectedFirstname ."' AND market ='".$selectedMarket."'"; and it worked fine, check to make sure there are values in your variables. -Steve -----Original Message----- From: R.S. Herhuth [mailto:ronherhuth@pop.mindspring.com] Sent: Monday, April 22, 2002 10:39 AM To: php-windows@lists.php.net Subject: [PHP-WIN] Quoted Dynamic Strings are killing me (Second Attempt) I have been trying to create strings dynamically by combining text and variables. Because SQL wants single quotes surrounding the values I have been forced to create the string as follows (all variables have been previuosly set earlier on the page): $query = "select bio FROM individual WHERE last_name ='". $selectedLastname ."' AND first_name ='". $selectedFirstname ."' AND market ='".$selectedMarket."'"; Which seems to be good to me but when I echo the query it parses out like this: select bio FROM individual WHERE last_name ='Appleyard selectedFirstname=Peter selectedMarket=Atlanta' AND first_name ='' AND market ='' What am I missing...or doing wrong? This seems so straightforward but I'm getting beat up something horrible! Thanks, Ron Herhuth -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#13226) next »