You are here: SQL Query not working as expected.... « PHP SQL « IT news, forums, messages
SQL Query not working as expected....

Posted by jerryyang_la1 on 09/24/06 10:52

Hi
I have created a form, for users to enter the name of a file and it
then gets displayed. This works..

I've editted it so the form now search through a few different fields
and tries to match..
This works EXCEPT !!

The field FileKeywords never seems to get searched.. Or more to the
poitn the results are never returned..

Have I screwed up the SQL Query or the writting of the results ??


//Get the number of results
$SearchResult=mysql_query("SELECT * FROM Files WHERE FileTitle LIKE
'%$SearchString%' || FileDescription LIKE '%$SearchString%' ||
FileKeywords LIKE '%$SearchString%' ORDER BY FileTitle") or
die(mysql_error());
$NumberOfResults=mysql_num_rows($SearchResult);

//Get the number of pages
$NumberOfPages=ceil($NumberOfResults/$Limit);

$SearchResult=mysql_query("SELECT * FROM Files WHERE FileTitle LIKE
'%$SearchString%' || FileDescription LIKE '%$SearchString%' ||
FileKeywords LIKE '%$SearchString% 'ORDER BY FileTitle LIMIT " .
($page-1)*$Limit . ",$Limit") or die(mysql_error());

While($row = mysql_fetch_object($SearchResult)) {

Echo "&nbsp;&nbsp;<a href=\"filestore/" . $row->FileLink . "\"><img
border=\"0\" src=\"smallicons/" . $row->FileIcon . ".gif\" width=\"20\"
height=\"20\"> $row->FileTitle</a> - " . $row->FileDescription .
"<br><br>";


Many Thanks for your help !!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация