What if else does not execute? & Lt ;? Phpif ($ _ POST [submit]) {$ itm]; $ ip $ _ SERVER [REMOTE_ADDR]; $ postdate & nbsp; date (Y-m-d & nbsp; H: I: s, & nbsp; time (); $ sqlselect & nbsp; ip & nbsp; fro else won't execute. why?
If ($ _ POST ["submit"]) {
$ Id = $ _ POST ["itm"];
$ Ip = $ _ SERVER ["REMOTE_ADDR"];
$ Postdate = date ('Y-m-d H: I: S', time ());
$ SQL = "select ip from ipadd where ip = '$ IP '";
$ Result = mysql_query ($ SQL );
$ Row = mysql_fetch_array ($ result );
If (mysql_num_rows ($ row) <1 ){
$ SQL = "insert into ipadd (ip, id, postdate) values ('$ IP',' $ ID', '$ postdate ')";
$ Res = mysql_query ($ SQL );
}
Else {
Echo "not empty ";
}
}
?>
This will only execute the first half of the IF, and the echo "not empty" in the back will not execute this operation. let's see what the problem is.
------ Solution ----------------------
If (mysql_num_rows ($ row) <1 ){
Change
If (mysql_num_rows ($ result) <1 ){