First insert to new table isn't working
-
Hi,
I created a new mySql table and I need the first field to be an index and a key.
I’m not sure I got the terminology right but I simply need that field to automatically increment by 1 with each insert.
So I defined that field as anindex
and gave it theauto_increment
attribute.
Now I try to insert the first row like this:$wpdb->insert('wp_branches', array(user_id=>$user_id, branchName=>$bname));
The index/key field
branchId
is missing from this query because I’m counting on the db to automatically give it the value 1 since it’s the first insert, and then increment it with every additional insert.
For some reason the row isn’t being inserted and db is left empty.
What am I doing wrong?
- The topic ‘First insert to new table isn't working’ is closed to new replies.