Couldn't execute query

QuestionsCouldn't execute query

Hi. I have this message error (IN LOCALHOST DOES NOT OCCUR)

Couldn’t execute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) pg_tmp‘ at line 1 –
SELECT count(*) as c FROM (SELECT  <…fields…> .WHERE ID=) pg_tmp

In my code the clausule WHERE IS:

WHERE id =”. $_SESSION[“id”]

Before I generate the session variable like this:


if ($_GET) {
if ( isset( $_GET['id'] )) {
$_SESSION["id"]=$_GET['id'];
} else {
$_SESSION["id"]=0;
}

I’m working with de version 2.6.3 build 20190926-0831

Thank you very much for your help and for your time.

Best regards.

3 Answers
Abu Ghufran Staff answered 4 years ago

Hi,

Perhaps, you need to remove the first IF condition.

if ($_GET) {

}

Because if there is no $_GET there will be nothing in session variable.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Javier Albornoz (Jujuy-Argentina) answered 4 years ago

Hi Abu, thanks for answering. The above code I posted wrong.
This is the correct one:

if ($_GET) {
___if ( isset( $_GET['id'] )) {
______$_SESSION["id"]=$_GET['id'];

___} // this key was missing
} else {
___$_SESSION["id"]=0;
}

So the sql statement always has the value for $ _SESSION [‘id’], but I keep getting the error mentioned in the original question.

Best regards.

Abu answered 4 years ago

Hi,

 

Another possibility may be, if you use session variable before calling session_start(); it will not read or set session vars.

Either put this code after including jqgrid_dist.php or call session_start() before this code.

If issue still remains unresolved, please send complete grid code so I can regenerate it here.

Your Answer

20 + 12 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?