db = cs4_open(); // すでに登録がないかを確認 $where = "user_id=\"".$p['uid']."\" and regist_date =\"".$date."\""; $num = cs4_num_rows($this->db,"bsc_bento_user",$where); //未登録の場合 if('0' == $num){ $data = array( "user_id" => $p['uid'], "regist_date" => $date, "main_rcp_no" => $p[r_id1], "submain_rcp_no"=> $p[r_id2], "sub_rcp_no" => $p[r_id3], ); //DBに格納 $ret_insert = cs4_insert($this->db,"bsc_bento_user",$data); //メインのレシピ名取得処理 $where = sprintf(" rcp_no = %s ", $p[r_id1]); $ct = cs4_num_rows($this->db,'bsc_r_new',$where); if(!empty($ct)){ $ret=cs4_select($this->db,"bsc_r_new",$where); //件数分だけループ while($row = cs4_fetch_row($ret)) { $main_nm = $row['rcp_nm']; } } //テンプレートの設定 if($ret_insert) { $template->setCurrentBlock('__Regist__'); $template->setVariable('main_nm',$main_nm); $template->parseCurrentBlock(); }else{ $template->touchBlock('__ShowError2__'); $template->hideBlock('__Regist__'); } }else{ $template->touchBlock('__ShowError__'); $template->hideBlock('__Regist__'); } $template->show(); //DB開放 cs4_close($this->db); } bentou_regist($p); ?>