B
B
badimint2014-11-12 01:59:03
Database
badimint, 2014-11-12 01:59:03

MSQL query in wordpress?

Не получается вставить запись в таблицу

$wpdb->query($wpdb->prepare("INSERT INTO order ( fio, email, tel, type, message) VALUES ( %s, %s, %s, %s, %s)",
            array( 
              $fio, 
              $email, 
              $tel, 
              $type, 
              $message 
            )
            ));

gives an error message

WordPress database 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 'order ( fio, email, tel, type, message) VALUES ( 'Name', '[email protected]', 'te' at line 1 ]
INSERT INTO order ( fio, email, tel, type, message) VALUES ( 'Name', '[email protected]', 'tel', 'master', 'Message')

I tried everything I could, tell me what is wrong in the request?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sydorenko, 2014-11-12
@badimint

Try changing the table name to at least my_order.. order is a function word, for order by

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question