我的代碼目標是顯示錶格批處理代碼中我的文本框中批次代碼數量的計數查詢,如果我點擊按鈕它將保存到批處理代碼表...我的批次代碼字段是在文本框中的顯示數量
「身份證」,「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
請提及您需要插入文本框的值或查詢結果。查詢結果是單值還是長數組? –