close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Custom SQL Query issue

Thread began 4/27/2011 11:47 am by david390068 | Last modified 5/07/2013 6:29 pm by Jason Byrnes | 4057 views | 20 replies |

david390068Beta Tester

Custom SQL Query issue

I have an issue and not sure how to fix. I am entering a custom query into the Custom SQL Query box and it returns and error that states:
Invalid JSON: 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 'SELECT * FROM pm1_users' at line 1. Any ideas?

Sign in to reply to this post

Jason ByrnesWebAssist

what is the entire query you are entering?

Sign in to reply to this post

david390068Beta Tester

SELECT * FROM pm1_users

literally just that.

Sign in to reply to this post

david390068Beta Tester

I figured it out... feel like an idiot...just realized that I am supposed to add the criteria for the search, not the whole query.

Sign in to reply to this post

Jason ByrnesWebAssist

OK, glad to hear you got it sorted.

Sign in to reply to this post

lesMatthews

New Column (VARCHAR)

I added a new column to the pm1_users table named UserCompany, but am unable to use it in an audience filter. Adding a WHERE clause such as below in the Custom SQL Query box, yields Invalid JSON syntax errors.

WHERE UserCompany LIKE 'Widget Corp'
or
WHERE UserCompany CONTAINS 'Widget Corp'
or
WHERE UserCompany = 'Widget Corp'

I tried double quotes ("") and escaping the single quotes with slashes (\').

Sign in to reply to this post

lesMatthews

Can't seem to use the LIKE operator with an already existing text column either.

Edit: Perhaps it's related to how quotes are escaped.
This filter:
WHERE UserCity LIKE 'Houston'
produces this error:
Invalid JSON: 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 '\'Houston\'' at line 1

Sign in to reply to this post

Jason ByrnesWebAssist

sounds like you have the magic_quotes_gpc option enabled on your PHP server. magic_quotes_gpc is depricated in newer versions of PHP and should be turned off in the php.ini file.

contact your host to have them disable the magic_quotes_gpc setting in the php.ini.

Sign in to reply to this post

lesMatthews

Originally Said By: Jason Byrnes
  sounds like you have the magic_quotes_gpc option enabled on your PHP server. magic_quotes_gpc is depricated in newer versions of PHP and should be turned off in the php.ini file.

contact your host to have them disable the magic_quotes_gpc setting in the php.ini.  



I'm on a shared-hosting server. They are not going to disable it on the server. They may have other clients requiring it, even if it is deprecated. I need a work-around.

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code to line 1 of the webassist/globals/globals.php file:

php:
<?php

if (get_magic_quotes_gpc()) {
    if(
$_SERVER['REQUEST_METHOD'] == "POST") {
        foreach(
$_POST as $k => $v) {
            
$_POST[$k] = stripslashes($v);
        }
    }
}
?>
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...