Jump to content

Archived

This topic is now archived and is closed to further replies.

olm75

multifield form search

Recommended Posts

$querystring .= " WHERE venuename LIKE '%$VT%'";

 

This will find any field the contains this value

Share this post


Link to post
Share on other sites

y is my query not bringing results....not found...i want the viewers to search using 1 or any combination of fields.....

 

 

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]

$querystring = \"select * from venues\";

if ($VN != \"\" AND $AC == \"\" AND $AG == \"\") {$querystring .=  \" where (venuename like \'%$VN%\')\";}

if ($VN != \"\" AND $AC != \"\" AND $AG == \"\") {$querystring .=  \" where (venuename like \'%$VN%\') AND (areacode like \'%$AC%\')\";}

if ($VN != \"\" AND $AC == \"\" AND $AG != \"\") {$querystring .=  \" where (venuename like \'%$VN%\') AND (agegroup like \'%$AG%\')\";}

if ($VN == \"\" AND $AC != \"\" AND $AG == \"\") {$querystring .=  \" where (areacode like \'%$AC%\')\";}

if ($VN == \"\" AND $AC != \"\" AND $AG != \"\") {$querystring .=  \" where (areacode like \'%$AC%\') AND (agegroup like \'%$AG%\')\";}

if ($VN == \"\" AND $AC == \"\" AND $AG != \"\") {$querystring .=  \" where (agegroup like \'%$AG%\')\";}

if ($VN == \"\" AND $AC == \"\" AND $AG == \"\") {}

[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

Share this post


Link to post
Share on other sites

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$querystring = \"select * from venues\";

if ($VN != \"\" AND $AC == \"\" AND $AG == \"\") {$querystring =  $querystring + \" where (venuename like \'%$VN%\')\";}[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

Share this post


Link to post
Share on other sites

ok thanks, but

do i just do that for all of the if statements or just that 1st one....

Share this post


Link to post
Share on other sites
ok thanks, but

do i just do that for all of the if statements or just that 1st one....

271773[/snapback]

 

All

 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.