Jump to content

simple search


benalex

Recommended Posts

Hey Everyone!

 

i just need a push in the right direction - whether that be a tutorial/website/script page etc

 

I'm looking at re-designing a website and adding some php functionality to it. How would i go about creating a search like this page: http://www.stafforgserv.com.au/TeacherJobSearch.htm

note: the current search doesn't work but thats the same kind of set-up that i'll be working on

 

this can be done with one table right?

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/55361-simple-search/
Share on other sites

Well that kind of table isn't so much a search as it is calling up data that specifically coorelates to it.

 

Example:

 

<?php

//Lets say you're form POST variables are apples, oranges, and noodles

connect_to_my_database();

$my_mysql = mysql_query( "SELECT * FROM myTable WHERE myAppleColumn = '$apples' AND myOrangeColumn = '$oranges' AND myPastaColumn = '$noodles'" )
                    or die( mysql_error() );

while( $row = mysql_fetch_array( $my_mysql ) ){

    $myReturnedID = $row['myIDorKeyColumn'];

    //Alternatively you can add this if you want multiple results
    $myEchoVar .= $myReturnedID;

}

echo( $myEchoVar );

?>

 

Hope this is also a gentle push in the right direction, do check the google results above though

 

 

Link to comment
https://forums.phpfreaks.com/topic/55361-simple-search/#findComment-273673
Share on other sites

Archived

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

×
×
  • Create New...

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.