Here are a couple of data type in mySQL:
// YYYY-MM-DD HH:MM:SS
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
status VARCHAR(1),
dateModify TIMESTAMP,
dateCreate TIMESTAMP,
solution TEXT
Here is the code to show the query from mySQL:
<?php
mysql_select_db("databaseName") or die(mysql_error());
global $dateChoose;
$result = mysql_query("SELECT * FROM databaseName WHERE dateCreate >= '$dateChoose' ")
or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo '<form name="update_form" action="<?php echo $PHP_SELF; ?>" method="post" align="right">';
echo '<table>';
echo '<tr>';
echo ' <td align="right">Modified:</td>';
echo " <td><input disabled type=\"text\" name=\"DateModify\" size=\"20\" value=\"{$row['dateModify']}\"></td>";
echo '</tr>';
echo '<tr>';
echo ' <td align="right">Status:</td>';
echo " <td><input type=\"text\" name=\"Status\" size=\"1\" value=\"{$row['status']}\"></td>";
echo '<tr>';
echo ' <td align="right">Solution:</td>';
echo " <td><textarea name=\"Solution\" rows=\"3\" cols=\"40\">{$row['solution']}</textarea>";
echo ' </td>';
echo '</tr>';
echo '<tr>';
echo ' <td colspan="2" align="center"><input type="submit" value="UPDATE" name="update_form">';
echo '</tr>';
echo '</table>';
echo '</form><br>';
} //end while
?>
<?php
if (isset($_POST['update_form'])) {
//update what ever is input such as STATUS Solution
//dateModify is
}
?>
That code above will output out a nice form with data from mySQL.
NOW I want to update what ever the user input back on form such as SOLUTION, STATUS, etc.. when they click UPDATE.
It would be nice to update all at once of all the inputs from the while loop output.
How would I do that using mySQL UPDATE, SET.
My problem is that my query in a while loop with different data output.
Maybe I set which ID can be update later?
An easy of updating from a tutorial:
<?php
// Connect to MySQL
// Get Sandy's record from the "example" table
$result = mysql_query("UPDATE example SET age='22' WHERE age='21'")
or die(mysql_error());
$result = mysql_query("SELECT * FROM example WHERE age='22'")
or die(mysql_error());
// get the first (and hopefully only) entry from the result
$row = mysql_fetch_array( $result ); echo $row['name']." - ".$row['age']. "<br />";
?>