?
Solved

Syntax fix

Posted on 2014-04-09
11
Medium Priority
?
171 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 668 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
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
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 664 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 58

Accepted Solution

by:
Julian Hansen earned 668 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

771 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