Adding a function

hewstone999

Geek Trainee
I have some code below which outputs a HTML table. The values in each cell come from a database. I want to add a function to the view and delete cell (marked in red) so when everytime a user clicks on it, it will do a SQL command i.e. "Delete * From ".$Dis. How can i do this??

Code:
$temp = 1;
while(!$rs->EOF){
	$date = $rs->Fields("date1")->value;
	$time = $rs->Fields("Time1")->value;
	$Dis = $rs->Fields("table_name")->value;
	

	if ($temp1 == 1){
	echo "<tr>";
		echo "<td><font size='-1'><b>Date</b>";
		echo "</td>";
		echo "<td><font size='-1'><b>Time</b>";
		echo "</td>";	
		echo "<td><font size='-1'><b>TableName</b>";
		echo "</td>";
	echo "</tr>";	
	}
	echo "<tr>";
		echo "<td><font size='-1'>".$date;
		echo "</td>";
		echo "<td><font size='-1'>".$time;
		echo "</td>";	
		echo "<td><font size='-1'>".$Dis;
		echo "</td>";
		echo "<td><font size='-1'>[color=#FF0000]View";[/color]
		echo "</td>";
		echo "<td><font size='-1'>[color=#FF0000]Delete";[/color]
		echo "</td>";
	echo "</tr>";

$temp = $temp + 1;	

	$rs->MoveNext();
 
Well... i think you'll need an other column table with a link like (w w w . s omething.org/delete.php?id=3). Where ?id is a get variable. Then in your script (delete.php) you 'll run a delete query based on this id.
 
Back
Top