I want to show message box with javascript with some codition from database, this is the example: controller
$email_cek = $this->model_select->select_member('where email = "$email"'); if($email_cek == 0){ $facebook = $this->input->post('facebook'); $facebook_cek = $this->model_select->select_member('where facebook = "$facebook"'); if($facebook_cek == 0){ //other script }else{ echo " alert('You can't use that facebook account because the account has been used by another member! save aborted!'); window.location.href='membership'; "; } }else{ echo " alert('Your e-mail is exist by another member! save aborted!'); window.location.href='membership'; "; }model
public function select_member($id=""){ $data_member = $this->db->query("select * from member ".$id); return $data_member->result_array(); }I have two forms twitter and facebook, and the existing data in database. if input type same or exist in database, I want to display a message according to the data that already exists. but why the message always email messagebox show??
try model :
public function select_member($id=""){
$data = $this->db->query("select * from member ".$id);
return $data;
}
Controller :
$email_cek = $this->model_select->select_member('where email = "$email"');
if($email_cek->num_rows() == 0){
$facebook = $this->input->post('facebook');
$facebook_cek = $this->model_select->select_member('where facebook = "$facebook"');
if($facebook_cek->num_rows() == 0){
//other script
}else{
echo "
alert('You can't use that facebook account because the account has been used by another member! save aborted!');
window.location.href='membership';
";
}
}else{
echo "
alert('Your e-mail is exist by another member! save aborted!');
window.location.href='membership';
";
}