0
votes

I'm trying to add a new row in a wordpress table (that i've created), but every times that i add the new row, all the others are deleted and if i look DB table i can see only last inserted row.

I've tried two methods, but i get the same results:

$ins_reply = $wpdb->insert( $table, array('itemid'=> $item_id, 'time' => $time, 'title' => '', 'text' => $content, 'author' => $user, 'deadline' => 0));

OR

$query_insert = "INSERT INTO ".$table." (`itemid` ,`time` ,`title` ,`text` ,`deadline` ,`author`) VALUES ('".$item_id."', '".$time."', '', '".$content."', '0', '".$user."')";
$wpdb->query($query_insert);

What's wrong in my code?

1

1 Answers

0
votes

Your query as posted in your question is not the source of your issue.

Perhaps you are working on a plugin where the table creation script is accidentally wiping & re-installing the table during this operation?