Reply to Re: Getting Query Failed and not sure why...

Your name:

Reply:


Posted by J.O. Aho on 02/08/07 23:02

Sloane T. Irwin wrote:
> Hi,
> I'm adding a search functionality to a newly created service request
> database. I copied over pretty much all of the code from a previous,
> currently working, inventory tracking database that I created. I
> changed the field names and whether I wanted "LIKE" or =, but still,
> all I get is a query failed message.
>
> Can someone help please!!!
>
> Query code is as follows:

Try this:

$thequery="SELECT * FROM support
WHERE (first LIKE '%$searchfor%' OR last LIKE '%$searchfor%' OR
priority LIKE '%$searchfor%' OR inventory='$searchfor' OR owner LIKE '%
$searchfor%' OR building LIKE '%$searchfor%' OR room='$searchfor' OR
email LIKE '%$searchfor%' OR phone LIKE '%$searchfor%' OR issue LIKE '%
$searchfor%' OR c_id LIKE '%$searchfor%')";
$query = mysql_query($thequery,$db);
if(!$query) {
echo $thequery ."<br>\n";
echo mysql_errno().": ".mysql_error()."<br>\n";
exit;
}
$numofrows = mysql_num_rows($query);


This way you get a lot better error information than using those "or die()"
statements. You want to see what query has been made and what error message.

--

//Aho

[Back to original 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

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