Help - Search - Members - Calendar
Full Version: Adding a Function
HTMLHelp Forums > Programming > Server-side Scripting
hewstone
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??

$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'>View";
echo "</td>";
echo "<td><font size='-1'>Delete";
echo "</td>";
echo "</tr>";

$temp = $temp + 1;

$rs->MoveNext();
Darin McGrew
Please see the FAQ entry How do I use forms?
Christian J
To update content from a DB on the fly --as opposed to submitting a form-- you can use AJAX. But it's more reliable to submit a form.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.