Mysql-variable
Dear Rich,
I have SQL query to upadate new data in dbase.
I have follow your script using function check (&$var)to initialize the variable and print these variable's value.
The problem is the page can get and display the updated values BUT dbase does not UPDATE the value. It still store the old value. That mean the update is not successful! :(
So, what's the problem?
Attach code:
<?php
.....
//Formulate and execute the query
$sql = "UPDATE product SET
prod_id= '$_POST[prod_id]',
b_type= '$_POST[b_type]',
descp=' $_POST[descp]',
cust_id= '$_POST[cust_id]',
person= '$_POST[person]',
mod= '$_POST[mod]'
WHERE prod_id= '$pro_id'";
....
?>
<?php
....
//query
$sql = "SELECT * FROM product WHERE prod_id = '$prod_id'";
.....
//function
function check(&$var)
{
return (isset($var))? $var :'';
}
echo" <br><b>\n".
" ".check($_POST['prod_id'])."\n".
" </b>\n".
" - The product has been updated to the database.\n".
" <p> </p>\n".
" <table width='45%' border='1'>\n".
" <tr>\n".
" <td>\n".
" <b>Product ID:\n".
" </td>\n".
" <td>\n".
" ".check($_POST['prod_id'])."\n".
" </td>\n".
" </tr>\n".
" <tr>\n".
" <td>\n".
" <b>Board Type:\n".
" </td>\n".
" <td>\n".
" ".check($_POST['b_type'])."\n".
" </td>\n".
" </tr>\n".
" <tr>\n".
" <td>\n".
" <b>Description:   ; \n".
" </td>\n".
" <td>\n";
?>
<textarea name='descp' cols='80' rows='5' id='desc'><? echo "".check($_POST['descp'])."\n"; ?></textarea>
<?php
echo " </td>\n".
" </tr>\n".
" <tr>\n".
" <td>\n".
" <b>Customer ID:\n".
" </td>\n".
" <td>\n".
" ".check($_POST['cust_id'])."\n".
" </td>\n".
" </tr>\n".
" <tr>\n".
" <td>\n".
" <b>Last Person:\n".
" </td>\n".
" <td>\n".
" ".check($_POST['person'])."\n".
" </td>\n".
" </tr>\n".
" <tr>\n".
" <td>\n".
" <b>Last Modified:\n".
" </td>\n".
" <td>\n".
" ".check($_POST['mod'])."\n".
" </td>\n".
" </tr>\n".
" </table>\n";
?>
Thanks in advance.
|