-3
这似乎很简单,但我不知道它为什么这样做鼻涕工作。php。如果条件
我需要写一个声明,如果
first, checks if it is numeric
second, if it is not between 1 and 10, issue errorA
third, if it is not between 20 and 30, issue errorB
fourth, it is not a number, issue errorC
如果不是数字,并满足所有范围,添加到数据库中。
反正,我不知道的,如果同时组合来满足这个....
到目前为止,我有,
如果数字和满足的范围,添加到数据库 否则,问题errorC
如何筛选错误A和B?
if (isset [some code...]) {
$a = ...;
$b = ...);
$c = ...;
if (preg_match('/^\d+$/',$b) && preg_match('/^\d+$/',$c) &&
((1 <= $b && 10 >= $b)) && ((20 <= $c && 30 >= $c))) {
$sql = "INSERT [some code...]
mysql_query($sql);
$_SESSION['success'] = $_POST['success'];
header('Location: index.php') ;
return;
} else {
$_SESSION['error'] = $_POST['error'];
header('Location: index.php') ;
return;
}
}
你应该表现出一些代码。 – 2013-02-25 20:19:15
这听起来像功课?虽然你可能想看看is_numeric,<, >和http://php.net/manual/en/control-structures.if.php – bizzehdee 2013-02-25 20:19:32
它怎么可能在1到10 ***和*** 10和20之间? ! – deceze 2013-02-25 20:23:54