Page 1 of 1

easiest way for advance search

Posted: Tue Mar 13, 2007 8:35 pm
by psychotomus
whats the easiest way to do this advance search feature. i kind of messed it up =(

http://www.phpldtemplates.org/advance_search.php

Heres what i have now and its limited. i want to be able to search for all tags selected. not exact input of the tags selected.

Code: Select all

$result = mysql_query("SELECT id,screen_url, name FROM themes WHERE
						column1='" . $tags[0] . "' AND
						column2='" . $tags[1] . "' AND
						column3='" . $tags[2] . "' AND
						mixed='" . $tags[3] . "' AND
						white='" . $tags[4] . "' AND
						yellow='" . $tags[5] . "' AND
						grey='" . $tags[6] . "' AND
						pink='" . $tags[7] . "' AND
						red='" . $tags[8] . "' AND
						orange='" . $tags[9] . "' AND
						blue='" . $tags[10] . "' AND
						green='" . $tags[11] . "' AND
						purple='" . $tags[12] . "' AND
						brown='" . $tags[13] . "' AND
						black='" . $tags[14] . "' AND
						left_sidebar='" . $tags[15] . "' AND
						right_sidebar='" . $tags[16] . "' AND
						adsense_ready='" . $tags[17] . "' AND
						no_images='" . $tags[18] . "' AND
						images='" . $tags[19] . "' AND
						plugins='" . $tags[20] . "' AND
						widget='" . $tags[21] . "' AND
						fixed_width='" . $tags[22] . "' AND
						fluid_width='" . $tags[23] . "' ORDER BY RAND() LIMIT 24") or die(mysql_error());

Posted: Thu Mar 29, 2007 10:45 am
by Benjamin
I don't know what the hell your trying to do but that just isn't right dude.

Can you please explain what records your trying to pull and why?

Posted: Fri Mar 30, 2007 2:00 am
by neel_basu
I am Explaining (Showing An Example) How Simple It is On Zigmoyd(http://zigmoyd.sourceforge.net/man/db.php#browse)
-------------------------------------------------------------

Code: Select all

<?php
$conn = mysql_connect("localhost", "root", "");
$test = new browse("db_name", "themes", $conn);//db_name, table_name, $conn
$test->set("column1", $tags[0]);//Set The GIVEN Fields, and its Value
$test->set("column2", $tags[1]);
$test->set("column3", $tags[2]);
//And Set Other Given Fields (mixed, white and......) Like This
$test->find("id", "screen_url", "name");//Multiple Arguments Can Also be Given
$result = $test->adv_output();//Advanced Output
print_r($result);
?>
Thank You

Posted: Fri Mar 30, 2007 6:25 am
by Chris Corbyn
~ psychotomus, read up on Relational Database Normalization. You just need to split your data into multiple tables.