mysqli_query()期望参数1是mysqli,非常困惑

时间:2015-04-23 17:24:45

标签: php mysql database mysqli

警告:mysqli_query()要求参数1为mysqli,第32行/home/a7874248/public_html/login.php中给出的资源

如何解决?

  <!doctype html>
  <html>
  <head>
  <meta charset="UTF-8">
  <title>Untitled Document</title>
  </head>

  <body>
  <?php
  if(isset ($_POST['submit']))
{

$user = $_POST['user']; 
$pass = $_POST['password']; 

$server = "mysql1.000webhost.com"; 
$username = "a7874248_root"; 
$password = "****"; 
$database = "a7874248_forum";

$db_handle = mysql_connect($server, $username, $password, $database) or die("Could not connect to database!");
$db_found = mysql_select_db($database, $db_handle);

if ($db_found) {
$sql = "SELECT * FROM users where username='$user' AND password = SHA1($pass)"; 
$QueryResult = mysqli_query ($db_handle, $sql); // Run the query.
if ($QueryResult === FALSE)
echo "<p>Wrong username or password</p>";
 else
 {

。 。 。 。 。

0 个答案:

没有答案