Select Certain <option></option>

  • treeleaf20
  • Born
  • Born
  • treeleaf20
  • Posts: 1

Post 3+ Months Ago

Hey guys I want to only select a few columns as an advanced search. The code to generate the options is:



php:
--------------------------------------------------------------------------------
foreach($_POST as $key=>$val){
$pFieldName[] = $key;
$pValue[] = $val;
}
$searchTXT = $_POST[searchTXT];
echo "Post Variable : $key - $val<br>";

$qryviewadvance = "
SELECT
(".implode(",",$pValue).")
FROM
master
WHERE '%$searchTXT%' order by '$column1'
";
echo "$qryviewadvance";
?>

--------------------------------------------------------------------------------



Then my query looks like this:
SELECT (RegionName,RegionName,UnitName,,,,,,,,,,,,,,,,,,,,,)
FROM master WHERE '%%' order by 'RegionName'

But I get these errors:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/treepsu/public_html/database/database.php on line 534


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/treepsu/public_html/database/database.php on line 546

Anyone have any ideas??
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Well, I'd guess ',,,,,,,,,,,,,,,,,,,,,' is probably one of your problems...

Also..

Code: [ Select ]
"WHERE '%$searchTXT%' order by '$column1'"


You have to give it a condition to check aganist..

Where what?

Where 1 = 2?
Where 2 >= 1?
Where RegionName like "%$SearchTXT%"

You have to give it a condition for the actual search.

String Comparison Functions @ MySQL.com

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: wpas and 75 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.