我有三个职能。第一个是插入会员的交易,这是可以的 公共功能process_newreceipt(){
$Bank = $this->test_data->test_input($_POST["Bank"]);
$Member = $this->test_data->test_input($_POST["Member"]);
$Amount = $this->test_data->test_input($_POST["Amount"]);
$phone = $this->mobileNo($Member);
$message='Thanks';
$insert=$this->receipt_model->new_receipt($Bank,$Member,$Amount,
if($insert>= 1)
{ sendsms($phone,$message);
echo '<script type="text/javascript">alert("successful");</script>';
redirect(base_url('index.php/Receipt/Receipt_Transactions'));
}
2nd function is to search mobileno to send sms to by the $member above
public function MobileNo($member){
$Query= $this->db->query("SELECT MOBILE FROM MEMBERS WHERE
ID_NO=$member" ); $row = $query->row();
$Phone=$row->mobile;
return $Phone;
} Third function is to send sms sendsms($phone,$message); which is called up there on insert success
我希望现在明白了。谢谢你们的快速回复
答案 0 :(得分:0)
// Use this method on codeigniter Model class and call this method in controller class
public function MobileNo($ID_NO)
{
// if you are not load database first load database
// $this->load->database();
// With Method Chaining
$query = $this->db->select( 'MOBILE')
->where( 'ID_NO', $ID_NO)
->get( 'MEMBERS');
$result = $query->row();
if($query->num_rows() > 0) {
echo $result->MOBILE;
}
else{
return false;
}
}