Re: inserting info from a query string into sql

From: Date: Tue, 20 Jan 2004 21:49:50 +0000
Subject: Re: inserting info from a query string into sql
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-175201@lists.php.net to get a copy of this message
It doesn't seem that you have declared the vars $reorder and $order, so that will make a bad query. "Mayo" <mayo@nycinteractive.com> wrote in message news:JAEAIALHCMBMKOKHBDEEGENMDLAA.mayo@nycinteractive.com... > 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

« previous php.general (#175201) next »