inserting info from a query string into sql
| From: | mayo | Date: | Tue, 20 Jan 2004 21:29:12 +0000 |
| Subject: | inserting info from a query string into sql | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-175198@lists.php.net to get a copy of this message | ||
PROBLEM
I'm trying to insert information from a query string into sql.
I have a table with content. The column headers have up and down arrows
allowing the user to sort and order by that column.
PHP
I have default settings set for the variables.
If I change the default values the SQL results changes. (good)
I can get the query string variables outside the sql.
<?php print "$category $section"; ?>
However I can't seem to insert the query string variables into the sql.
<?php
function whatever(){
$username = "";
...
// setting the default variables
if(!isset($category)){$category="Something";}
if(!isset($section)){$section="SomethingElse";}
$connection=@mysql_connect($hostname,$username,$password);
mysql_select_db($database);
$selection = mysql_query("
SELECT *
FROM classes
WHERE
classCategory = '$category'
ORDER BY $reorder $order
")
...
?>
What am I missing here?
thx,
Gil