我应该做一个“检查”,应该有(Index,id,....),但索引应该在100之后重置,但是id必须是auto_incremented。 这是我的代码,我做了什么。我没有得到如何重置索引到0.我甚至不能显示索引值,它显示0每当我添加的东西。如何将索引重置为0
<?php
$host = "localhost";
$user = "root";
$password = "";
$database = "dbcar";
$number = "";
$state_number = "";
$model = "";
$status = "";
$conditions = "";
$date = "";
$number_index = "1";
$connect = mysqli_connect($host,$user,$password,$database);
echo "<h1>Report Log </h1>";
$sqlget = "SELECT * FROM carserv ORDER BY date DESC LIMIT 1";
$sqldata = mysqli_query($connect,$sqlget) or die("error");
echo "<table>";
echo"<tr>
<th>INDEX</th>
<th>ID</th>
<th>State Number</th>
<th>Model</th>
<th>Status</th>
<th>Condition</th>
<th>Date</th>
</tr>";
while($row = mysqli_fetch_array($sqldata,MYSQLI_ASSOC)){
echo" <tr><td>";
echo $row['number_index'];
echo" </td><td>";
echo $row['number'];
echo" </td><td>";
echo $row['state_number'];
echo" </td><td>";
echo $row['model'];
echo" </td><td>";
echo $row['status'];
echo" </td><td>";
echo $row['conditions'];
echo" </td><td>";
echo $row['date'];
echo" </td></tr>";
}
echo "</table>";
function getPosts(){
$posts = array();
$posts[0] = $_POST['state_number'];
$posts[1] = $_POST['number'];
$posts[2] = $_POST['model'];
$posts[3] = $_POST['status'];
$posts[4] = $_POST['conditions'];
$posts[6] = $_POST['number_index'];
return $posts;
}
?>
,这里是我的输出:http://imgur.com/GOuCcBU
'SELECT'不更改数据库,'INSERT /更新'做。很难说你的真实代码是什么。 –
另外,'INDEX'是一个MySQL保留字https://dev.mysql.com/doc/refman/5.7/en/keywords.html - 查看你的截图。 –
我可以告诉你我的整个代码,如果你想 – deluxion