tags:

views:

31

answers:

2

Hi,

I come across this sql code in a php software. What does the #section_filter mean? Is that a valid mysql syntax? or just a templating system?

$filterid = ac_sql_select_one("
    SELECT
        id
    FROM
        #section_filter
    WHERE
        userid = '$ary[userid]'
    AND
        sectionid = 'article'
    AND
        conds = '$conds_esc'

");

Thanks

+2  A: 

It is a valid sql syntax but the problem i suspect is that hash # character creates comments in sql queries hence this query might not execute.

Another possiblity is that the program that you saw this query in should be able to dynamically replace the #section_filter with some table name before it gets to mysql engine and then the query should run fine. This is the highest possibility in my view.

Sarfraz
A: 

The # symbol is one way to express a comment in MySQL. So, this isn't a valid SQL statement as written, since the line:

#section_filter

would be completely ignored.

danieltalsky