Solved

Syntax fix

Posted on 2014-04-09
11
169 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
Technology Partners: 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …

742 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