Hi there,

I am building a picture search engine with a gui where the user can choose
categories and then choose from those categories several points.

It is almost impossible to build a querry out of that. I am having a problem
keeping it dynamic. It works if I am naming the category, but I would like
to make it dynamic

Here is an example what I am trying to get:

assuming there are following values:

$glacier = array("g_one", "g_two");

$lake = array ("l_one", "l_two");

$mountain = array ("m_one", "m_two");

// this returns the value for glacier

echo $glacier[1]; // g_two

// This code is creating a querry. User has a gui where he can choose
between the categories.

// It should loop through all possibilities Thats why I tryed to make the
$glacier $$category But somehow this does not work

// The problem is, that I want to loop through all. So I do not know if it
is a glacier, lake or mountain the user selected

building the querry:

if ($glacier[0] == 'empty'){ // show all glaciers

$search = "glacier IS NOT NULL";


else{ // show particular

$search = "glacier =";

for($i=0; $i<count($glacier); $i++){

$search .= $glacier[$i];

# add OR if it is not the last in the array

if ($i < (count($glacier)-1)) $search .= " OR glacier =";



Do you see my trouble??

Thanx for any help

Cheers Andy

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

Reply via email to