RE: [PHP] Looking for help with forms/variables and an array!

From: Date: Tue, 12 Jun 2007 20:12:56 +0000
Subject: RE: [PHP] Looking for help with forms/variables and an array!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-256772@lists.php.net to get a copy of this message
On Tue, June 12, 2007 12:02 pm, BSumrall wrote: > Every single example on the internet is for register_globals = on. Actually, this is not at all true. And, really, fixing the example before you run it to not need register_globals is the way to go. > As far as the brackets, I tried with or without; > price_range='[$select1]'"; > price_range='$select1'"; > price_range=select1"; > > All the same miserable error! Not EXACTLY the same miserable error. You're still writing invalid SQL, but it's invalid in different ways each time. echo out your query, and see how it looks, and compare it to how the query should look. echo $query_Recordset1; PS extract($_POST) is just as bad as register_globals, so don't do that. Maybe you want something more like: $price_minimum = (int) $_POST['select1']; $price_maximum = (int) $_POST['select2']; $price_minimum_sql = mysql_real_escape_string($price_minimum); $price_maximum_sql = mysql_real_escape_string($price_maximum); $query = "select * from whatever where price >= $price_minimum_sql and price <= $price_maximum_sql"; Though it looks like you've set up price "brackets" so maybe it won't be quite like that... Still it's closer than what you have now. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#256772) next »