<--- this is my view-->
<?php
if ($exec == 'true'){
echo '<script type="text/javascript">
alert("email alreay exist");
</script>'
}
?>
<?php endif; ?>
<-- this is my controller -->
function email_taken($input){
$query="select * from dentaldoctors where email='$input'";
$exec=$this->db->query($query) or die(mysql_error());
if($exec) {
true
} else {
FALSE;
}
}
下面做什么?
<?php endif; ?>
您正在关闭一个不存在的 if 语句 - 基于您给出的代码。
你在两个 if 语句中都缺少分号
视图
if ($exec == 'true'){
echo '<script type="text/javascript">
alert("email alreay exist");
</script>';
}
控制器
if($exec) {
true;
} else {
FALSE;
}
请按照上述说明替换您的代码。 我希望它能为你工作!
简单的答案。从代码中删除<?php endif; ?>
,它就像一个魅力。此外,在语句末尾添加;
echo