I want to grab the specific $key and $id and insert it into my sql table, How can i get the $key and $id? If i just had 1 row, i could have solve it, but since its a while loop, do i have to do it other way?
I've tried with key as a start like this
if(isset($_POST['$key']))
When i press my button for update
if(isset($_POST['$key'])) {
$dbhost = '*****';
$dbuser = '*****';
$dbpass = '*****';
$conn = db2_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ');
}
$postkey = $_POST['$key'];
$sql = "UPDATE Products SET , KEY = $key, ID = $ID, DONE = 'X' " ;
$retval = db2_exec( $conn, $sql);
if(! $retval ) {
die('Could not update data: ' . db2_stmt_errormsg());
}
echo "Updated data successfully
";
db2_close($conn);
}
Looping my tables
while((db2_fetch_row($queryexe)){
$key = db2_result($queryexe, 'KEY');
$id = db2_result($queryexe, 'ID');
$done = db2_result($queryexe, 'DONE');
print("<td>$key</td>
");
print("<td>$id</td>
");
print("<td><button name = '$key' type='submit' id = '$key' class='btn btn-default'>
<i class='glyphicon glyphicon-repeat'></i> Done
</button></td>
");
print("</tr>
");
Sorry if im unclear. I've tried my best