Jump to content

Search not working properly


ksduded

Recommended Posts

I have a search function which takes input from the user and then goes through my records searching in a few fields for the keyword and then prints out the results.

 

$resulttime picks up the timings from a field called prog_time2

$sql is my search query (which seems to be working fine)

 

 

$resulttime = mysql_query("SELECT *, TIME_FORMAT( prog_time, '%l:%i %p') AS prog_time2 from rushhd_schd");
$sql = "SELECT * FROM rushhd_schd WHERE prog_programname LIKE '%{$string}%' OR prog_episodename LIKE '%{$string}%' OR prog_episodedesc LIKE '% {$string} %' ORDER BY prog_date ASC";
$query = mysql_query($sql);

while ($info = mysql_fetch_array($query)) { //echo out the results
{
$ptime = mysql_fetch_array($resulttime);

......

 

The problem is that even though the search is picking up the right records, my resulttime is not picking up the data from the field associated with that record. It just picks up the field from the first record. Which is quite evident from my coding.... How should I change it so that my resulttime only picks up the prog_time field from only the searched query.

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/148843-search-not-working-properly/
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.