<--- 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;
}
}
Asked
Active
Viewed 3,580 times
-3

Tom
- 4,257
- 6
- 33
- 49

suhail ahmed
- 122
- 1
- 12
-
in your echo your missing ; at the end of the line – Demonyowh May 09 '17 at 08:20
-
where did u begin the end if you are closing? and you missing a semi colon to terminate the echo statement – Masivuye Cokile May 09 '17 at 08:26
3 Answers
1
What is the following doing?
<?php endif; ?>
You're closing a non existent if statement - based on the code you've given.

Tom
- 4,257
- 6
- 33
- 49
-
From the edit history it shows that the OP did not have that end if it shows that you are the one that put it there see [Your edit](http://stackoverflow.com/revisions/43864635/2) Against [OP's edit](http://stackoverflow.com/revisions/43864635/1) – Masivuye Cokile May 09 '17 at 08:37
-
1@MasivuyeCokile Actually, if you look at the source of the original post - http://stackoverflow.com/revisions/73b2a8c0-598a-4cd9-b8d4-0eb7bd2604d4/view-source - you'll see that the `` is already there. I just formatted it correctly. – Tom May 09 '17 at 08:39
-
1@MasivuyeCokile You've also therefore rolled back a completed fine edit. Do you know what you're doing? – Tom May 09 '17 at 08:40
0
You are missing semicolon in both of if statement
View
if ($exec == 'true'){
echo '<script type="text/javascript">
alert("email alreay exist");
</script>';
}
Controller
if($exec) {
true;
} else {
FALSE;
}
Please replace your code as per above explanation. i hope it will work for you !

Devdutt Sharma
- 391
- 1
- 2
- 10
0
SIMPLE ANSWER. REMOVE THE <?php endif; ?>
FROM YOUR CODE AND IT WORKS LIKE A CHARM. ALSO, ADD ;
AT THE END OF echo
STATEMENT

xXAlphaManXx
- 161
- 1
- 6
-
-
All answers just focus on the `;` and useless things. They don't see the question asked by the OP and the error produced to OP – xXAlphaManXx May 09 '17 at 09:00