[wp-hackers] Delete Row - Refreshes Page but not DB

BenderisGreat greglancaster71 at gmail.com
Sat Oct 19 17:25:25 UTC 2013

I thought it looked weird.  I spent some time last night working out the
correct code pasted here, and got it functioning.  I dont think I can get my
money back but I will try. I am so glad I have this resource to check with,
or I would have never had JD showing me the proper way, and then never would
have questioned his code.  

I finally got JDs code working but I have to place this in my functions for
ajax to work:


function custom_head()
	echo '';

Is that alright?  Otherwise I get ajaxurl undefined error.  

Additionally, the json response works too! However one query always fails.  

$file = $_POST['file'];
$del_image = wp_delete_attachment( $row['file'] ); - fail

I also tried this as an sql query:

$file = $_POST['file'];
$fileQry = $wpdb->prepare("DELETE FROM wp_posts WHERE id = %s", $file);
$go_fileQry = $wpdb->query($fileQry);

It still fails.  It IS possible to run multiple queries this way right?  

View this message in context: http://wordpress-hackers.1065353.n5.nabble.com/Delete-Row-Refreshes-Page-but-not-DB-tp42393p42566.html
Sent from the Wordpress Hackers mailing list archive at Nabble.com.

More information about the wp-hackers mailing list