ここに私のプログラムのコードがあります:
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
$host = "localhost";
$user_name = "usr";
$pwd = "pwd";
$database_name = "my2"; //assuming you created this
mysql_connect($host, $user_name, $pwd)or die(mysql_error());
mysql_select_db($database_name)or die(mysql_error());
$datee = $_POST['datee'];
$time = $_POST['time'];
$destination = $_POST['destination'];
$days = $_POST['days'];
$cab = $_POST['cab'];
$route = $_POST['route'];
$full_name = $_POST['full_name'];
$address = $_POST['address'];
$mobile_number = $_POST['mobile_number'];
$pickup_location = $_POST['pickup_location'];
$query2 = "SELECT `order_number` FROM `count` WHERE 1";
$countQuery = mysql_query($query2)or die(mysql_error());
while($row = mysql_fetch_array($countQuery))
{
$order_number = $row["order_number"];
}
$query3 = "UPDATE `count` SET `order_number` = '".$order_number."'+ 1 WHERE 1";
mysql_query($query3)or die(mysql_error());
$query1="INSERT INTO booking VALUES ('".$datee."','".$time."','".$destination."','".$days."','".$cab."','".$full_name."','".$ad dress."','".$mobile_number."','".$pickup_location."','".$route."','".$order_number."')";
mysql_query($query1)or die(mysql_error());
?>
<html>
<body>
<div style="border:1px solid black;background-color:#FAFA23;width:600px;height:100px;">
<table>
<tr>
<td>
<?php
echo "Your order number is :".$order_number;
?>
</td>
</tr>
<tr align="center">
<td>Thank you for booking, We will contact you soon ! </td>
</tr>
</table>
</body>
</html>
このプログラムを実行すると、毎回余分な行が 1 つ追加されます。このコードの問題点を教えてください。また、列の値を 1 増やしたい場合は、2 ずつ増やします。order_number=order_number+1;