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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux