<?php
include ("account.php") ;
( $dbh = mysql_connect ( $hostname, $username, $password ) )
or die ( "Unable to connect to MySQL database" );
print "Connected to MySQL<br>";
mysql_select_db($project);
$number = NULL ;
$username = $_POST["username"];
$priority = $_POST["priority"];
$category = $_POST["category"];
$incident_description = $_POST["incident_description"];
$sql = "insert into incident values ( NULL, '$username','$priority','$category','$incident_description',curdate(),curtime() )" ;
mysql_query ( $sql ) or print ( mysql_error ( ) );
$credentials = "select * from Credentials where ("username" = '$username' ,"password" = '$password' , "email_address" = 'email_address')" ;
print $credentials;
$result = mysql_query ($credentials) or print (mysql_error ( ) );
$howManyRows = mysql_num_rows ( $result);
//if $howManyRows is positive continue process to update database with sql,if not,die.
?>
另一个文件上的表单有一个 html 代码,因此是 $_POST,但我认为没有必要在这里显示它,因为我需要在这个 php 文件上使用正确的语法。
对于如何将 html 表单中的值与数据库中的表中的值进行比较的部分,$credentials
我需要帮助?我需要这样做以授权这些值进行该过程。我得到的语法目前不正确,因为它没有正确执行。我只是不知道如何比较两者。整个过程一直有效。(username,password,email_address)
"Credentials"
mysql_query ( $sql ) or print ( mysql_error ( ) )
建议会很好。我为这个长问题道歉!
PS:Credentials 表的列username,password,email_address
也是如此!