Syntax error at "h" And SQLPrepare() failed

princegoyal91
Posts: 12
Joined: Mon Jul 21, 2014 5:46 am

Syntax error at "h" And SQLPrepare() failed

Post by princegoyal91 »

Hi Team,

I have indexed the records in texis DB. But whenever I try to search the data from front end, it does not show any results.

On checking logs I am getting below error:

015 2015-03-18 07:00:13 /webinator/search:1966: Line 7: syntax error at "h"
000 2015-03-18 07:00:13 /webinator/search:1966: SQLPrepare() failed with -1 in the function prepntexis

On debug the code I found that this "h" is coming from a RAM table which ideally must have other values(Numeric values).

I tried killing the cache of Linux server as-well but it could not help.

Please Advise as soon as possible as it is very urgent.

Thanks for the co-operation.

Regards,
Dipander Goyal
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Syntax error at "h" And SQLPrepare() failed

Post by John »

The message indicates the "h" is part of a SQL statement. What is the complete SQL statement on line 1966? Are you pulling parts of the SQL from a RAM table? If so I think that must be a modified script, so it's difficult to diagnose without more information. Please email support to start a more indepth process.
John Turnbull
Thunderstone Software
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Syntax error at "h" And SQLPrepare() failed

Post by mark »

Show us the code on, and possibly around, line 1966 of your search script.
princegoyal91
Posts: 12
Joined: Mon Jul 21, 2014 5:46 am

Syntax error at "h" And SQLPrepare() failed

Post by princegoyal91 »

Thanks for the quick response.

on line 1966, we are pulling the part of query from RAM table.

Query is:

<sql "select count(*) ic from $tablename where ProdName\Desc\Keywords likep $likep_query
and (" $comsqlquery $sqlGrpsQuery ") " $commCatgClause>
</sql>

$comsqlquery variable fetches the information from RAM Table.

Is there any way to get the records a particular RAM table is containing?
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Syntax error at "h" And SQLPrepare() failed

Post by John »

The RAM table only exists in the process it's running in, so a select * from the table is the way to get the records.
John Turnbull
Thunderstone Software
princegoyal91
Posts: 12
Joined: Mon Jul 21, 2014 5:46 am

Syntax error at "h" And SQLPrepare() failed

Post by princegoyal91 »

Yes, RAM table is present only in that process.

Can you please tell me if there is any particular PATH/Location to run this select query for RAM Table?
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Syntax error at "h" And SQLPrepare() failed

Post by mark »

$tablename can't be a parameter. Try
"select count(*) ic from " $tablename " where ...

And make sure $tablename is sanitized (not coming from user input).
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Syntax error at "h" And SQLPrepare() failed

Post by mark »

But since the syntax error is at line 7, perhaps the problem is in your $comsqlquery $sqlGrpsQuery or $commCatgClause.

Turn on tracesql to see what's actually getting executed.
princegoyal91
Posts: 12
Joined: Mon Jul 21, 2014 5:46 am

Syntax error at "h" And SQLPrepare() failed

Post by princegoyal91 »

Sorry, I did not get the path where we will run your mentioned query("select count(*) ic from " $tablename ") for RAM Table.
princegoyal91
Posts: 12
Joined: Mon Jul 21, 2014 5:46 am

Syntax error at "h" And SQLPrepare() failed

Post by princegoyal91 »

I kept sqltrace ON and below query is getting executed:

select Prod, ProdName, Busid, SubBusid, SupCommFlag, comm_hits, Desc, Keywords from community where ProdName\esc\Keywords likep ? and ( ( CommRstdFlag=0 or Prod in ( h:&#9618;&#9618; )) ) ; FAILED

It says Prod in (h:) but "Prod in" must have few id's. Example (Prod in(1232,2434))

This "Prod in" query data is coming from RAM Table and it is the part of $comsqlquery.
Post Reply