[wp-hackers] Delete Row After Submit - Undefined

Gregory Lancaster greglancaster71 at gmail.com
Fri Oct 11 20:25:52 UTC 2013


the delete post link is because I am storing this other information in a
separate table.  So I have to delete it from that table, and then grab the
attachmend-id i stored in the row and call that delete function to remove
it from the wordpress media library.


On Fri, Oct 11, 2013 at 1:22 PM, Nikola Nikolov <nikolov.tmw at gmail.com>wrote:

> I don't think you need to call the get_delete_post_link() function.
>
> Since you're deleting the entry with $wpdb->query() . Just remove the
> get_delete_post_link() line and your code should work just fine :)
>
> Nikola
>
>
> On Fri, Oct 11, 2013 at 11: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
> >
> _______________________________________________
> 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