Search the Community
Showing results for tags 'php mysql html date'.
-
What I want to do is update the date/time field when the check box or a button is selected for that specific row only. on clicking the button it should get the current date and time and store it into the database in the date/time field. Is this possible to do? here is a snapshot of my code so far. <?php $query1 = "SELECT * FROM software"; $result1 = mysql_query($query1); $id = $row['SoftwareID']; $time = time(); $timestamp = $_POST[date('Y-m-d H:i:s', $time)]; $query2 = "UPDATE software SET timestamp = '$timestamp' WHERE SoftwareID = '$id'" ; ?> <br> <table border ="1" width="justified" <tr> <th><center>Version Number </th></center> <th><center>Defect Number</th> <th><center>Description</th> <th><center>Date/Time</th> <th><center>Ready?</th> </tr> <?php while ($row = mysql_fetch_array($result1)) { $versionnumber = $row['VersionNumber']; $defectnumber = $row['DefectNumber']; $description = $row['Description']; $timestamp = $row['timestamp']; ?> <tr> <td><?php echo $versionnumber; ?></td> <td> <?= $defectnumber ?></td> <td> <?= $description ?></td> <form action="" method="post"> <td> <?= $timestamp ?></td> <td> <input type="submit" value="Submit Time"></td></form> </tr> <?php } ?> </table> </br> insert.php <?php include("databaseConnection.php"); $versionnumber = $_POST [versionnumber]; $defectnumber = $_POST [defectnumber]; $description = $_POST [description]; $qry = "INSERT INTO software (versionnumber, defectnumber, description) VALUES ('$versionnumber','$defectnumber','$description')"; $result = mysql_query($qry); if ($result) { echo "information submitted, "; header("location: developer_dashboard.php"); exit(); } else { die("There was an error, try again later"); } ?>