//first get the record in the text box then follow the code..........and see in class file.
<?php
include("../config/connection.php");
include("../template/tmp_menu.php");
if(isset($_REQUEST['save']))
{
include("../class/user.class.php");
$o_u=new User();
$_record = array('name'=>$pro_name,'quentity'=>$pro_quentity,'rate'=>$pro_rate);
$o_q = $o_u->AddRecord('product',$_record);
$i_up = $o_u -> Uploadimages();
print "<META http-equiv='refresh' content='0;URL=../template/tmp_product.php'>";
}
?>
<html>
<head>
</head>
<body>
<form method="post" enctype="multipart/form-data">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="pro_name" ></td>
</tr>
<tr>
<td>Quentity:</td>
<td><input type="text" name="pro_quentity" ></td>
</tr>
<tr>
<td>Rate:</td>
<td><input type="text" name="pro_rate" ></td>
</tr>
<tr>
<td><input type="submit" name="save" value="save"></td>
</tr>
</table>
</form>
</body>
</html>
------------------------------------------------------------------------------------------------------------
//this is the class file...
<?php
class User
{
public function SelectRecord($table,$field)
{
$qr = "select * from $table where id_$table = '$field'";
$o__user = mysql_query($qr);
return $o__user;
}
//update records.
public function UpdateRecord($table,$field,$id)
{
$qr= "update $table set ";
foreach($field as $key => $value)
{
$a_qr[] = "$key = '$value'";
}
$ss_str = implode(',',$a_qr);
$qr.= $ss_str;
$qr.= " where id_$table = '$id'";
mysql_query($qr);
return true;
}
}
?>
<?php
include("../config/connection.php");
include("../template/tmp_menu.php");
if(isset($_REQUEST['save']))
{
include("../class/user.class.php");
$o_u=new User();
$_record = array('name'=>$pro_name,'quentity'=>$pro_quentity,'rate'=>$pro_rate);
$o_q = $o_u->AddRecord('product',$_record);
$i_up = $o_u -> Uploadimages();
print "<META http-equiv='refresh' content='0;URL=../template/tmp_product.php'>";
}
?>
<html>
<head>
</head>
<body>
<form method="post" enctype="multipart/form-data">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="pro_name" ></td>
</tr>
<tr>
<td>Quentity:</td>
<td><input type="text" name="pro_quentity" ></td>
</tr>
<tr>
<td>Rate:</td>
<td><input type="text" name="pro_rate" ></td>
</tr>
<tr>
<td><input type="submit" name="save" value="save"></td>
</tr>
</table>
</form>
</body>
</html>
------------------------------------------------------------------------------------------------------------
//this is the class file...
<?php
class User
{
public function SelectRecord($table,$field)
{
$qr = "select * from $table where id_$table = '$field'";
$o__user = mysql_query($qr);
return $o__user;
}
//update records.
public function UpdateRecord($table,$field,$id)
{
$qr= "update $table set ";
foreach($field as $key => $value)
{
$a_qr[] = "$key = '$value'";
}
$ss_str = implode(',',$a_qr);
$qr.= $ss_str;
$qr.= " where id_$table = '$id'";
mysql_query($qr);
return true;
}
}
?>