Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
building a search facility?
Old 06-27-2005, 07:22 AM building a search facility?
Experienced Talker

Posts: 35
Trades: 0
Hi Guys,

I want to build a search facility, bit like the one at;

http://www.bbc.co.uk/cgi-bin/search...llbbc&x=36&y=17

for example. I want it to search my 'archive' table and output the 'headline' of the results that is searched as a link (as per the BCC) then output the 'opening_paragraph' also saved in my archive table. Can someone point me in the right direction? Maybe an existing thread or example.

Thanks

Chris
chrisb is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-27-2005, 12:24 PM
Novice Talker

Posts: 8
Trades: 0
It's rather unclear exactly what you are asking, but typically this sort of search button does something equivalent to the following: -

The search button is a simple HTML form which sends the results either as GET through the URL or POST (hidden and more secure) to a named script. In a PHP script the name of the text box in the form is gathered as a variable. So if the form text box was named mybox, PHP would pick it up as $mybox. $mybox would equal whatever the user had entered. This variable can then be used in the SQL query on your table. If PHP was accessing a mysql database it would use the function mysql_query and load the results into an array in the form $result = mysql_query("select .... where ... = '$mybox'"). The results are then read with something like
while ($row = mysql_fetch_assoc($result)) {
extract($row); ....
where each field in the select statement is returned as a variable so select name, adresss would now be read row by row as $name, $address. as the rows are read they are formatted for the screen, often in the form of a table so each row could be output as
print "<TR><TD>$name</TD><TD>$adress</TD></TR>

to provide say the address result as a link output something like

print "<TR><TD>$name</TD><TD>$adress</TD></TR><a href=\"http://(web address)/get_addr.php?name=$name&address=$address>$address</a></td></tr>";

This would produce a list of names and addreses with the adress as a link. When the link is clicked it sends $name and $address to the website and the script get_addr.php which then picks the 2 variables up as $name and $address which can then be used in another SQL query. And so it can go on and on.

Bob
bobfarq is offline
Reply With Quote
View Public Profile
 
Old 06-28-2005, 09:34 AM
Experienced Talker

Posts: 35
Trades: 0
Thanks Bob!
chrisb is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to building a search facility?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11497 seconds with 12 queries