Insert or Update

R::ext(‘xdispense’, function( $type ){
return R::getRedBean()->dispense( $type );
});

 

 

 

$check_exist = R::getRow(“SELECT *FROM manager_data where reportid=:reportid “,array(“:reportid”=>$id));
if(count($check_exist)==0)
{
$save = R::xdispense(“manager_data”);
$save->manager_ref_id = REQUEST(“manager_ref_id”);

R::store($save);
echo “Succesfully Data Inserted.”;
}
else
{
$save = R::load(‘manager_data’, $check_exist[“id”] );

$save->manager_ref_id = REQUEST(“manager_ref_id”);
$save->action = REQUEST(“action”);
$save->reportid = REQUEST(“manager_ref_id”);

R::store($save);
echo “Succesfully Data Updated”;

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s