I am building a custom ,module with a custom content type. I have defined the content type and created my form.
The “Title” is being put into the {node} table with the respective nid, however I need to enter the rest of my data into my custom table.
Its just not working 🙁
I am using hook_insert
This is the function
function svm_mail_insert($node) {
db_query("INSERT INTO {svm_mail_esp_acc} (vid, nid, api_name, esp_id, api_key) VALUES (%d, %d, '%s', %d, %s)", $node->vid, $node->nid, $node->account, $node->esp_refferer, $node->api_key);
}
Any Ideas what Im doing wrong and also how can I see the $node array after the form has been processed, but before the data is entered into the db to ensure that the $node is actually being populated?
Sorry to sound like a parser but…You have an error in your SQL syntax!
You’re putting a string value into the query without putting quotes around it…MySQL will have a fit with that. It’s the last value, for the
api_keycolumn, that’s missing the quotes: