Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

kuckovic on "$wpdb"

$
0
0

Hi everyone!

I'm developing a plugin, and I'm almost done.
I have some issues though.

When I add something to my database, it's shown on my admin-dashboard. That part works fine and dandy! But! I want a "Delete" button to each "item"..

This is how i "Call" the items from my DB:

global $wpdb;
$table_name = $wpdb->prefix."comment_reminder";
$cremindsql = $wpdb->get_results("SELECT * FROM $table_name ORDER BY id DESC");

As I said, that part works great!
Now, I want to add a DELETE button - I just can't figure out how I do this. I have this code for now:
$delblog = $wpdb->query("DELETE FROM $table_name WHERE id ='1');

How can I make "WHERE id = '1'" to be automatic?
I mean, I have a button beside each item, not I need, somehow, to put an "id" to each button?

How do I do this? :(

Thanks
Kucko


Viewing all articles
Browse latest Browse all 8245

Trending Articles