我正在尝试创建一个订单状态页面,我将在 phpmyadmin 中手动调整,但是我希望人们能够使用表格输入他们的订单号,然后为该订单号提供适当的名称和状态。
这是 index.php
<?php
$username = "username";
$password = "password";
$hostname = "localhost";
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
?>
<form method="POST" action="action.php">
<input type="text" name="term" />
<input type="submit" value="Submit" name="submit" />
</form>
这是我的 action.php
<?php
$username = "evo_readle";
$password = "judo08";
$hostname = "localhost";
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
$term = mysql_real_escape_string($_REQUEST['term']);
$query = mysql_query("SELECT * FROM orders WHERE number ='%".$term."%'");
$user = mysql_fetch_assoc($query);
echo "Hello User, your name is" .$user['name'];
?>