我的代码目标是显示表格批处理代码中我的文本框中批次代码数量的计数查询,如果我点击按钮它将保存到批处理代码表...我的批次代码字段是在文本框中的显示数量
“身份证”,“batchcode”
我当前的代码:
<?php
ob_start();
?>
<html>
<head>
<title>test</title>
</head>
<body>
<?php
include('include/connect.php');
$query = "SELECT DISTINCT count(batchcode) FROM batchcodes";
while($rows = mysql_fetch_array($query)) {
}
?>
<?php
if(isset($_POST['save'])){
$var = $query+1;
$sql = "INSERT INTO batchcodes(batchcode) VALUES ('$var')";
}
?>
<form method="post" action="index.php" >
<input type="text" value="batch<?php echo $query; ?>" />
<input type="submit" name"save" />
</form>
</body>
</html>
在我的代码我可是从像未定义的变量查询,并警告mysql_fetch_array错误患预计参数1 ...我需要你的帮助家伙。
你有*在你从中获取结果之前执行*查询。 –
1.执行您的查询。 2.你将在'$ rows'中得到结果。 3. ** mysql _ ***函数是[弃用](https://wiki.php.net/rfc/mysql_deprecation)。 – Rikesh
请提及您需要插入文本框的值或查询结果。查询结果是单值还是长数组? –