Re: [PHP-GENERAL] Need help with MySQL....
[email protected] (David Robley)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On 18 May, Scott S. Nicholson wrote:
> I realize this isn't strictly PHP3, but...
>
> I developed a site with a PHP script to search a database for keywords with
> a certain field. On my local (Win32) box, it worked just fine, but when I
> uploaded it to a Red Hat server, it doesn't work.
>
> To be more specific... The search form allows you to choose to find ANY or
> ALL of the terms entered (OR or AND, basically). For an AND search, the
> script creates a query along the lines of:
>
> SELECT * FROM artwork WHERE keywords LIKE '%car%' AND keywords LIKE
> '%truck%';
>
> I can enter this query in PHPMyAdmin on the Red Hat box, and it returns the
> expected results, but when my script runs it, it executes the "die" portion
> of "$result = mysql_query($query, $mysql_link) or die(...);"
>
> Any ideas on that?
>
> The other problem is an OR search, for which I have the script generate a
> query along the lines of:
>
> SELECT *, IF (Keywords LIKE '%car%',1,0) 'car', IF (Keywords LIKE
> '%truck%',1,0) 'truck' FROM artwork HAVING car>0 OR truck>0 ORDER BY car
> DESC, truck DESC, ImageID ASC;
>
> which, on my Win32 box, finds all records containing any terms and orders
> them by relevance (ie records with multiple search terms are listed higher
> than those with only one).
>
> This query doesn't work on the Red Hat box, whether in PHPMyAdmin or in my
> script.
>
> Any ideas?
>
> TIA for the help.
After your database queries in the script, use mysql_error() to see
what, if any, error is being returned by the mysql daemon; this may
assist your debugging.
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA