Query with special character

QuestionsQuery with special character
Cedric asked 1 year ago

I can not make this query work in phpgrig.
The query works fine when it’s called in a MySQL tool like SQLyog
With phpgrid it always returns the error right syntax to use near ”\nf_nt4 …  I have tried several options but can’t make it work.
Do you have any tips to fix this?

4 Answers
Abu Ghufran Staff answered 1 year ago

There seems to be some limitation in escaping function of library.
One way to solve it is by escaping \ character again: e.g.
$g->select_command = str_replace(‘\\’,’\\\\’,$g->select_command);
This will skip the error. However when it comes to rendering, grid will remove \ character again as it assumes it as escaped character. To fix display edit lib/inc/jqgrid_dist.php and remove these lines:
foreach($row as $k=>$r)
$row[$k] = stripslashes($row[$k]);

Abu Ghufran - Dev Team
PHP Grid Framework
Cedric answered 1 year ago

ok thanks for the tips. I will look in creating a view in Mysql to avoir editing your library.

Cedric answered 11 months ago

Hello Abu,
I am still stuck with this.
Can you hekp me in fixing the escape characters?
This does not work:
$g->select_command = str_replace(‘\\’,’\\\\’,$g->select_command);
nor this
$g->select_command = str_replace(‘\\’,’\\\\’,$sql);

Abu Ghufran Staff answered 11 months ago

Here is working demo code:
I’m also emailing you updated build.

Abu Ghufran - Dev Team
PHP Grid Framework
Cedric replied 11 months ago

thank you Abu, it is working fine now.

Your Answer

4 + 11 =

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 / 5. Vote count:

As you found this post useful...

Follow us on social media!

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

Let us improve this post!