所以我有这个简单的 do_signup.php 部分代码:
<?php
$conn=oci_connect('system', 'user');
if(!$conn){
echo 'Can not connect';
}
$uname=$_POST['username'];
$pass=$_POST['password'];
$pstmt1="select * from admin where username='$uname'";
$stdi1=oci_parse($conn, $pstmt1);
oci_execute($stdi1);
oci_fetch($stdi1);
$numrow=oci_num_rows($stdi1);
if($numrow==0){
$pstmt2="insert into admin(username,password) values('$uname', '$pass')";
$stdi2=oci_parse($conn, $pstmt2);
oci_execute($stdi2);
oci_close($conn);
header('Location: signup_success.php');
}else{
oci_close($conn);
header('Location: signup_fail.php');
}
?>
当我的表为空时,我总是被重定向到 signup_fail.php。再说一遍,为什么?