Solved

Syntax fix

Posted on 2014-04-09
11
170 Views
Last Modified: 2014-04-11
"'CurrentUserID()' OR FIND_IN_SET('office', sharegrpall) OR FIND_IN_SET('" . CurrentUserID() . "', sharegrp)) "

What am I missing here?
0
Comment
Question by:Starquest321
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 

Author Comment

by:Starquest321
ID: 39989327
There is some issue with syntax
0
 
LVL 35

Assisted Solution

by:Dan Craciun
Dan Craciun earned 167 total points
ID: 39989337
Can you post the whole query?
0
 

Author Comment

by:Starquest321
ID: 39989356
It's actually part of a select statement . . . embed
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:Dan Craciun
ID: 39989363
OK. Can you post the php code?
Cause your original code does not really look like php.
0
 

Author Comment

by:Starquest321
ID: 39989367
The code is generated by itself . . . I just create the filter. . . so I just need the part between the quotes
0
 
LVL 35

Expert Comment

by:Dan Craciun
ID: 39989376
I still don't get it.

In php a variable has a $ in front, so sharegrpall and sharegrp have to be constants.
Apart from the fact that it's common practice to name the constants in ALL CAPS, are they defined as constants?

CurrentUserID() has to be a function. Where is it defined and what does it return?
0
 
LVL 22

Assisted Solution

by:Kim Walker
Kim Walker earned 166 total points
ID: 39989413
The first 'CurrentUserID()' is in single quotes so it is probably being handled as a string. The second CurrentUserID() appears to be a function that generates a string that's being concatenated with the the strings before and after it because it is between two dots or concatenate operators.
0
 

Author Comment

by:Starquest321
ID: 39989430
you are in the right direction. . .

userid is an int 11
where as the other two fields are varchar 300 fields.  . .

The error seems to be when I added my self the userid
0
 
LVL 22

Expert Comment

by:Kim Walker
ID: 39989661
Either way, none of this is PHP. It appears that you're using PHP to generate an SQL statement. But you say you're creating a "filter" and you've posted a screen capture of what might be an error that's being generated.

What are you trying to communicate with in PHP, a database? What kind of database? You may want the topic administrator to add the kind of database to the question topic so experts in that topic will know to look at the question.

you are in the right direction. . .
What leads you to believe I'm in the right direction? Have you made a change that lead to a different error? Please post the changed code and how it changed the results.
0
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 167 total points
ID: 39989697
Based on your other post

http://www.experts-exchange.com/Programming/Languages/SQL_Syntax/Q_28044665.html

shargrpall is a db field that (I assume) contains a comma separated string that could contain the word 'office' or the CurrentUserID()

What you have not made clear is what you are trying to do - the inclusion of CurrentUserId() as a quoted string in the filter is creating confusion - as you are using it as a concatenated value in the same string.

Which is it to be - evaluated by PHP as a function call.

...' . CurrentUserId() . '...

Or as a MySQL interpreted function as
'CurrentUserID() OR ...'

I suspect the former in which case you need to add the item to your filter string as a PHP function call - not as a string

$filter .= CurrentUserId() . ' ... rest of filter';

Having said that - you need to provide more information - you have not made clear what the problem is, what the error is or any other information that would enable a quick solution to the problem. The more information you provide the easier it will be to help you.
0
 

Author Comment

by:Starquest321
ID: 39993427
Perfect. You all helped. Figured it out!
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question