SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ADODB question regarding quoting behavior

    Not sure if I am in the right place, so forgive me if I'm not.

    I am using an adodb abstraction layer to communicate with a mysql db. The problem is that why I run the query() function, adobd is putting quotes into it, which is causing an error.

    I have a function that loops through an array, and generates a query from it:

    PHP Code:
    $query "SELECT ? FROM ? WHERE var = ?";

    $res $this->query($query,
                        array(
    $arr['var_name'],$arr['table_name'],$cond)
                ); 
    Code:
    this results in:
    mysql error: You have an error in your SQL syntax. Check the manual that 
    corresponds to your MySQL server version for the right syntax to use near 
    ''table' WHERE var=''1'' A in query:
    
    SELECT ? FROM ? WHERE var='?'
    Obviously, the problem is that the quotes are not appropriate when referring to a table in mysql (should use ` or nothing).

    so the simple question is how do i trick adodb so that it does not wrap the varaible in quotes before passing to the db, so that the WHERE statement does not mess up?

    Any help would be much appreciated.

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    south
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •