:: Forum >> Version 1 >>

Delete a row from a php grid

Hi all,

I have been searching the forum for a few hours and still can't find any simple instructions on how to delete a row from a grid in php. Does anyone have a simple example?

Ideally I would like multiple row selection, and for the user to simply press "delete key", a confirmation box, and then to delete the rows from the grid, delete the rows from mySQL and then refresh the grid.

I am just using the simple:
----
// grid object name
$name = "obj";

// SQL query
$query = "select number,message,datetime AS Date from tl_numbers WHERE customer = '$user' ";

$result = mysql_query($query);

// add grid to the page
echo activewidgets_grid($name, $result);
---

Can someone help me with the next few steps?

Many thanks,

Alastair
Alastair
Saturday, November 12, 2005
Me looking for the same, but could suggest u smthg which may help u
Create the grid loading the data, with row indices as the unique ids of
your data in the DB.

Write the code on the keypress event of delete button(keyCode=46 for delete button)
through XMLHTTPRequest method, Pass the row index to a PHP script and
then handle that script to delete the record from the DB based on the value of the row index
Remember ur row index shud be the unique id of the record meant to be
deleted.

As soon as i explore a bug free code for deletion of record i'll post it.
Otherwise flow is this only.

Cheers :)
Ritesh Jagga
Wednesday, November 23, 2005
can someone show this?
my regards
vule
Saturday, November 26, 2005



This topic is archived.

Back to support forum

Forum search