-6

このコードでエラーが発生しました。このコードのどこが間違っていますか? 解析エラーにより、このエラーも発生しました(SCREAM:エラー抑制は無視されました)。

1.     <?php   
2.    session_start(); 
3.      $name=$_POST['email']; //email, pass is the id='' field from table
4.      $passs=$_POST['pass'];
5.        mysql_connect("localhost","root",""); //db connection file
6.      mysql_select_db("secg");
7.       $_SESSION['email']='$name'; //for security purpose
8.   $result=mysql_query("select * from student where Email='$name and password='$passs'");
9.          $row=mysql_fetch_array($result);
10.        if($row>0)
11.           {
12.              header("location:index.htm");  }
13.           else  {
14.           die('could not be opened because of' mysql_error() ); }               
15.    ?>               
4

3 に答える 3

5

その die() に欠落しているドットがあります

die('could not be opened because of'.mysql_error())
于 2013-06-25T13:10:47.430 に答える
1

交換してみる

$_SESSION['email'] = $name;

そして、SQLクエリの後にこれを与える

die('could not be opened because of'.mysql_error())

それはあなたにmysqlエラーを与え、また非推奨mysql_*であるためステートメントを使用しないためです.Insted useステートメントまたはmysqli_*PDO statements

于 2013-06-25T13:10:21.367 に答える
1

ドットがありません:

die('could not be opened because of' . mysql_error() );
于 2013-06-25T13:11:07.657 に答える