Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 没有错误,但我可以';在数据库中看不到我的数据_Php_Mysql_Encryption - Fatal编程技术网

Php 没有错误,但我可以';在数据库中看不到我的数据

Php 没有错误,但我可以';在数据库中看不到我的数据,php,mysql,encryption,Php,Mysql,Encryption,我使用PHP将代码插入MySQL,但当我查询数据库时,在数据库中找不到任何内容。我不知道发生了什么事。我的数据库中有五个字段(ID、用户名、电子邮件、密码、salt)。下面是我的PHP代码 <?php include 'db_connect.php'; include 'functions.php'; $password = $_POST['password']; $random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandma

我使用PHP将代码插入MySQL,但当我查询数据库时,在数据库中找不到任何内容。我不知道发生了什么事。我的数据库中有五个字段(ID、用户名、电子邮件、密码、salt)。下面是我的PHP代码

<?php
include 'db_connect.php';
include 'functions.php';

$password = $_POST['password']; 

$random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));

$password = hash('sha512', $password.$random_salt);
if ($insert_stmt = $mysqli->prepare("INSERT INTO members (username, email,  
password,salt) VALUES (?, ?, ?, ?)"))

{    
$insert_stmt->bind_param('ssss', $username, $email, $password, $random_salt); 

$insert_stmt->execute();
echo 'User added';       
}
else
{
echo 'Error couldnt add the user, Try again';
}

?> 

下面是我的注册表格

 <form id="form1" name="form1" method="post" action="Registration Process.php">
  <table width="373" height="130" border="1">
    <tr>
      <td width="180" height="27">Username (Name &amp; Surname)</td>
      <td width="140"><label for="username"></label>
      <input type="text" name="username" id="username" /></td>
    </tr>
    <tr>
      <td height="23">Email</td>
      <td><label for="email"></label>
      <input type="text" name="email" id="email" /></td>
    </tr>
    <tr>
      <td height="22">Password</td>
      <td><label for="password"></label>
      <input type="text" name="password" id="password" /><label for="salt">    </label> </td>
    </tr>
    <tr>
      <td height="22">Salt</td>
      <td><input type="text" name="salt" id="salt" /></td>
    </tr>
    <tr>
      <td height="22">Click To register member</td>
      <td><input type="submit" name="register" id="register" value="Submit" /></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <!-- end .content -->
</form>

用户名(姓名和姓氏)
电子邮件
密码
盐
单击以注册成员


您可能无法从代码中的
POST
数组中获取
$username
$email
和其他变量


此外,您没有在
$insert\u stmt->execute()
函数中捕获错误-有关详细信息。

您可能没有从代码中的
POST
数组中获取
$username
$email
和其他变量


此外,您的
$insert\u stmt->execute()
函数中没有捕捉到错误-有关详细信息。

这是否正确??action=“Registration Process.php”带有空格?如何填充所有其他变量?像
$username
$email
等等-我看不到它们被设置在你的代码中。。。此外,在
$insert\u stmt->execute()
函数中没有捕捉到错误-有关更多信息,请参阅info@swapnesh是的,我认为它是正确的,但是为了参数起见,我会更改它,同时也会更改文件名。thanx@ZathrusWriter哦,我忘了通过post方法来做这件事,让我添加它,我会回复你的…@ZathrusWriter thanx它现在很有效,因为它没有获得$username和$email值…我现在添加了它们,它很有效。Thanx很多:)这是正确的吗??action=“Registration Process.php”带有空格?如何填充所有其他变量?像
$username
$email
等等-我看不到它们被设置在你的代码中。。。此外,在
$insert\u stmt->execute()
函数中没有捕捉到错误-有关更多信息,请参阅info@swapnesh是的,我认为它是正确的,但是为了参数起见,我会更改它,同时也会更改文件名。thanx@ZathrusWriter哦,我忘了通过post方法来做这件事,让我添加它,我会回复你的…@ZathrusWriter thanx它现在很有效,因为它没有获得$username和$email值…我现在添加了它们,它很有效。Thanx很多:)