고객의 ID를 입력하라는 양식이 들어있는 코드를 작성해 왔습니다. 양식을 제출하면 양식에 PHP가 입력되어 데이터베이스에 액세스하고 입력 된 ID에 대한 정보 테이블을 표시합니다 .데이터베이스에서 특정 데이터를 생성 하시겠습니까?
그러나 ID를 입력하고 제출할 때 내 PHP가 작동하지 않는 것 같습니다.이 오류 메시지가 나타납니다. "SQL 구문에 오류가 있습니다. 해당 MySQL 서버 버전에 해당하는 설명서를 확인하십시오. 올바른 구문을 사용하는 근처 '='987451 ''라인 1 "에서 다음
내 HTML입니다 : 당신이 더 많은 informati가 필요한 경우<body>
<?php
$conn = mysql_connect("localhost", "twa312", "dam6av9a");
mysql_select_db("warehouse312", $conn)
or die ('Database not found ' . mysql_error());
$cust = $_GET["custID"];
$sql = "select * from orders";
$sql = $sql . "where customerID = '$cust'";
$rs = mysql_query($sql, $conn)
or die ('Problem with query' . mysql_error());
?>
<p>information for customer ID <?php echo $cust ?> :</p>
<?php if (mysql_num_rows($rs)>0){ ?>
<table width="700" border="1" cellpadding="10" summary="Customer Details">
<tr>
<th>Order Number</th>
<th>Order Date</th>
<th>Shipping Date</th>
</tr>
<?php while ($row = mysql_fetch_array($rs)) { ?>
<tr>
<td><?php echo $row["orderNumber"]?></td>
<td><?php echo $row["orderDate"]?></td>
<td><?php echo $row["shippingDate"]?></td>
</tr>
<?php } mysql_close($conn); ?>
</table>
<?php }
else {?> <p>No customer with ID <?php echo $cust ?> in the database</p>
<?php } ?>
</body>
: 여기
<body>
<h1>Task 8</h1>
<form id="customerform" action="task8.php" method="get">
<p>please fill in the following form</p>
<p>Customer ID: <input type="text" name="custID" /><br/>
<p><input type="submit" value="Submit">
<input type="reset" value="Reset"></p>
</form>
</body>
내 PHP입니다 그냥 물어 보면 도움이 될거에요!
에 활짝 열려있어. 대신에 mysqli_ 또는 PDO를 사용하십시오. – akluth