Solved

Syntax fix

Posted on 2014-04-09
11
164 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
  • 5
  • 3
  • 2
  • +1
11 Comments
 

Author Comment

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

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
 
LVL 34

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 34

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 52

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Online file editor, manager 6 56
php ssh2_scp_send 1 46
Hacked File Timestamps 4 47
MySQL Grouping 2 15
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

939 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now