Skip to content

Instantly share code, notes, and snippets.

@des1roer
Created October 16, 2015 05:03
Show Gist options
  • Save des1roer/2e4bf07f2fb9e8a217f4 to your computer and use it in GitHub Desktop.
Save des1roer/2e4bf07f2fb9e8a217f4 to your computer and use it in GitHub Desktop.
public static function new_shihta($id_template, $time, $temp_name)
{
$new_shihta = Yii::app()->db->createCommand()
->select('id')
->from('vgok_site.a_analiz_create')
->where("template_id = $id_template
AND f_timestamp = '$time'")
->queryScalar();
if (!empty($new_shihta))
{
return $new_shihta;
}
else
{
$command = Yii::app()->db->createCommand();
$command->insert('vgok_site.a_analiz_create', array(
'name' => $temp_name,
'template_id' => $id_template,
'f_timestamp' => $time,
));
$insert_id = Yii::app()->getComponent('db')->getLastInsertID('a_analiz_create_id_seq1');
return $insert_id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment