
January 14th, 2013, 10:14 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 1
Time spent in forums: 13 m 23 sec
Reputation Power: 0
|
|
|
PHP-General - Add one value to all records in mysql
Hi everyone, I'm sult, I want to ask you a question, I'm create table takes values from databases(MySQL) and print all the fields from the database, after presenting this information I want to make the user to this application by simply pressing a button will increase the value in the field as well by one and store the values in Mysql, also I want to add another button to give the value zero in column addition to all fields, can u please explain to me how to do it?
And I'll show you some code to design the currency
* Note I use Dreambox Weaver as an assistant to me in programming
Thank you
URL
Code:
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<?php do { ?>
<tr bgcolor="#FFFFFF" style="text-align:center">
<td nowrap="nowrap"><?php echo $row_rs_add_std['stnum']; ?></td>
<td nowrap="nowrap"><?php echo $row_rs_add_std['stname']; ?> </td>
<td nowrap="nowrap"><?php echo $row_rs_add_std['stnum']; ?></td>
<ol><td nowrap="nowrap"> </td></ol>
</tr>
<?php } while ($row_rs_add_std = mysql_fetch_assoc($rs_add_std)); ?>
Code:
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE studentstab SET Additions=%s WHERE stnum=%s",
GetSQLValueString($_POST['Additions'], "int"),
GetSQLValueString($_POST['stnum'], "int"));
mysql_select_db($database_conmk, $conmk);
$Result1 = mysql_query($updateSQL, $conmk) or die(mysql_error());
}
|