i got an amazing error like this yesterday :p
SQLSTATE[42000]: Syntax error or access violation:
1064 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 'to=1)' at line 10#0
/home/aissam/workspace/fotomod/library/Zend/Db/Statement.php(298):
Zend_Db_Statement_Pdo->_execute(Array) #1
after a bit of debugging i found that they have
nothing
to do with access violation.
in case your made the same mistake as me, i describe
the problem there:
the instruction causing the exception was :
$msg->fetchAll(array("to=?"=>$id));
the problem was in field named to, that generate a
query like this :
SELECT ... WHERE (to=1)
things that mysql doesn't like since "to" is reserved
word
to resolved this you must quote identifier :
$to=$msg->getAdapter()->quoteIdentifier('to');
$msg->fetchAll(array("$to=?"=>$id));
i don't know if it'll be a good idea if we quote the
identifier automaticly by default on mysql (at least
on Zend_Db_Adapter_Pdo_Mysql). Any way the note appear
clearly on the manuel (RTFM :p)
[
Note
The values and identifiers in the SQL expression are
not quoted for you. If you have values or identifiers
that require quoting, you are responsible for doing
this. Use the quote(), quoteInto(), and
quoteIdentifier() methods of the database adapter.
]
i hope that this will help :)
--- mihu <[EMAIL PROTECTED]> a écrit :
>
> Is there some sort of mysqli permission limitation?
> I got a exceptions from Zend_DB_TABLE and I am
> thinking it might be
> something to do w/ mysqli user permission.
>
> Can someone clear this for me?
>
> thanks,
> --
> View this message in context:
>
http://www.nabble.com/Zend_DB_TABLE-and-mysqli-permission-tf4552830s16154.html#a12992638
> Sent from the Zend Framework mailing list archive at
> Nabble.com.
>
>