Help Needed with malfunctioning query

Help Needed with malfunctioning query

am 26.02.2006 06:03:32 von Chris Payne

------=_NextPart_000_0004_01C63A68.14E639C0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi there everyone,

This line of code USED TO WORK but now it gives me a Coudln't Execute Query
error:

$query2 = "SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword'
IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage";

I tried it with a basic $query2 = "SELECT * FROM dictionary"; to make sure
it wasn't something else that was broke and this is the problem above, it
used to work great and now it's on a live site after working great for 6
months and it suddenly doesn't work and I haven't touched anything !!! the
server hasn't been updated so it's not that as it also does the same on my
local dev machine here, the only thing that happened was my co-worker did a
global find and replace with dreamweaver but that's all and I can't
personally see anything wrong with the above though I could be looking too
hard.

Any help would REALLY be appreciated as this is on a very popular website
and needs fixing ASAP so I don't lose my head !!!

Chris

------=_NextPart_000_0004_01C63A68.14E639C0--

RE: Help Needed with malfunctioning query

am 26.02.2006 06:30:35 von Chris Payne

Hi there,

I'm using asd just to test the search, here's the output from the statement
echoed to the screen:

SELECT word,def,photo, if(locate('asd',word),1,2) as meFirst
,MATCH(word,def) AGAINST ('asd' IN BOOLEAN MODE) AS m FROM dictionary WHERE
MATCH(word,def) AGAINST ('asd' IN BOOLEAN MODE) ORDER BY meFirst, word LIMIT
0, 25

Chris

>This line of code USED TO WORK but now it gives me a Coudln't Execute
>Query
>error:
>
>$query2 = "SELECT word,def,photo MATCH(word,def) AGAINST
>('$txtsearchword'
>IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
>('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage";

What is the exact error phrase? Did you echo the $sql statement so you can
see if the variables are correct?


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 2/24/2006

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Help Needed with malfunctioning query

am 26.02.2006 06:33:39 von lists

On 26/02/2006 3:03 PM, Chris Payne wrote:
> Hi there everyone,
>
> This line of code USED TO WORK but now it gives me a Coudln't Execute Query
> error:
>
> $query2 = "SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword'
> IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
> ('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage";
>
> I tried it with a basic $query2 = "SELECT * FROM dictionary"; to make sure
> it wasn't something else that was broke and this is the problem above, it
> used to work great and now it's on a live site after working great for 6
> months and it suddenly doesn't work and I haven't touched anything !!! the
> server hasn't been updated so it's not that as it also does the same on my
> local dev machine here, the only thing that happened was my co-worker did a
> global find and replace with dreamweaver but that's all and I can't
> personally see anything wrong with the above though I could be looking too
> hard.
>

Should there be a comma between 'photo' and 'MATCH(word, def) etc'?

As in:
$query2 = "SELECT word,def,photo, MATCH(word,def) AGAINST
('$txtsearchword' IN BOOLEAN MODE) AS m FROM dictionary WHERE
MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) LIMIT
$offset, $item_perpage";


Much warmth,

planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org

"Urban legends, superstitions, ghost
stories and folklore"
http://www.ulblog.org

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Help Needed with malfunctioning query

am 26.02.2006 17:23:24 von El Bekko

Chris Payne wrote:
> Hi there everyone,
>
> This line of code USED TO WORK but now it gives me a Coudln't Execute Query
> error:
>
> $query2 = "SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword'
> IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
> ('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage";
>
> I tried it with a basic $query2 = "SELECT * FROM dictionary"; to make sure
> it wasn't something else that was broke and this is the problem above, it
> used to work great and now it's on a live site after working great for 6
> months and it suddenly doesn't work and I haven't touched anything !!! the
> server hasn't been updated so it's not that as it also does the same on my
> local dev machine here, the only thing that happened was my co-worker did a
> global find and replace with dreamweaver but that's all and I can't
> personally see anything wrong with the above though I could be looking too
> hard.
>
> Any help would REALLY be appreciated as this is on a very popular website
> and needs fixing ASAP so I don't lose my head !!!
>
> Chris
>

I tested your SQL on
http://developer.mimer.com/validator/parser200x/index.tml#pa rser
and got this:

----

Result:
SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword'
^ ^
syntax error: ,
correction: JOIN ON ) ,
syntax error: )
correction: =

IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
^------ ^--- ^---- ^------
syntax error: BOOLEAN
correction: (
syntax error: FROM
correction: ) FROM
syntax error: MATCH
correction:
syntax error: ) AGAINST
correction: = AGAINST

('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage
^------ ^---- ^
syntax error: BOOLEAN
correction: (
syntax error: LIMIT $ offset ,
correction: ,
syntax error: $ item_perpage
correction: item_perpage


^
syntax error:
expected: ( ) * + , - -> . / :: < <= <> = > >= [ || AND AS AT BETWEEN
COLLATE DAY HOUR IN IS LIKE MATCH MEMBER MINUTE MONTH
MULTISET
NOT OR OVERLAPS SECOND SIMILAR SUBMULTISET YEAR
correction: ) )

----

Hope it helps :)

-- Bekko

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php