db = cs4_open(); // すでに登録がないかを確認 $where = "car_no=\"".$p['uid']."\" and p_no=".$p['id']." and p_knd = 2 and list_dlt=0"; $num = cs4_num_rows($this->db,"bsc_list",$where); // お気に入りレシピの登録件数を確認 $where = sprintf("car_no='%s' and p_knd = 2 and list_dlt=0", $p['uid']); $num2 = cs4_num_rows($this->db,"bsc_list",$where); if($num == '0' && $limit > $num2){ $recipe = get_rcpDetail($this->db,$p['id']); $data = array( "car_no" => $p['uid'], "p_no" => $recipe[0]['uniq_id'], "p_knd" => '2', "gnr_no" => $recipe[0]['p_gnr'], "list_dlt" => "0" ); $ret_insert = cs4_insert($this->db,"bsc_list",$data); // $ret_insert = 1; if($ret_insert) { $template->setCurrentBlock('__Regist__'); $template->setVariable('recipe_name',$recipe[0]['rcp_nm']); $template->parseCurrentBlock(); }else{ $template->touchBlock('__ShowError2__'); $template->hideBlock('__Regist__'); } }else if($num != '0'){ $template->touchBlock('__ShowError__'); $template->hideBlock('__Regist__'); }else if($limit <= $num2){ $template->touchBlock('__ShowError3__'); $template->setVariable('limit', $limit); $template->hideBlock('__Regist__'); }else{ $template->touchBlock('__ShowError__'); $template->hideBlock('__Regist__'); } $template->setVariable('rcp_no',$p['id']); $template->setVariable('contents',$p['contents']); $template->setVariable('back_chr',$back_chr); $template->show(); cs4_close($this->db); } favor_regist($p); ?>