[wp-hackers] Delete Row After Submit - Undefined

J.D. Grimes jdg at codesymphony.co
Fri Oct 11 20:21:47 UTC 2013


What are you expecting the $row variable to be? Where are you expecting it to come from?

On Oct 11, 2013, at 4:13 PM, BenderisGreat <greglancaster71 at gmail.com> wrote:

> I have an issue that is apparently ongoing that I didnt realize until I
> turned on debug mode.  I have a delete button on every row of a table, and
> when clicked it grabs the row ID and erases that information.  However it
> also grabs a field from the picture row (its a post id for the image
> attachment) and attempts to delete that as well.
> 
> <?php      
> 	if (isset($_POST['id'])) {
> 	$id = $_POST['id'];
> 	if (isset($_POST['deleteItem'])) {
> 		get_delete_post_link( get_the_ID( $row['file']));
> 	$qry = "DELETE FROM wp_jo_plugin_options WHERE id = ".$id."";
> 	$jo_remove_row = $wpdb->query($qry);
> 	}    
> 	} 
> ?>
> 
> 
> 
> The problem is that its telling me that $row is an undefined variable.  If I
> put it inside the while loop it works, but then the page requires a refresh
> after deletion because the table is loaded before the delete code is.  Is
> there any solution to this?  Possible to redefine a variable upwards in the
> document order possibily?
> 
> 
> 
> --
> View this message in context: http://wordpress-hackers.1065353.n5.nabble.com/Delete-Row-After-Submit-Undefined-tp42521.html
> Sent from the Wordpress Hackers mailing list archive at Nabble.com.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list