我正在尝试在我的网站上做手风琴之类的事情,但是每次我尝试回声时,我都会收到一条错误消息。
解析错误:语法错误,意外的““”,预期为T_STRING或T_VARIABLE或T_NUM_STRING
当我这样做时,我最终得到了它:
echo "ItemID: " . $row["ItemID"]. " - ItemName: " .
任何帮助将不胜感激。
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#accordion" ).accordion();
} );
</script>
</head>
</html>
<?php
include "db_connect.php";
$keywordfromform = $_GET["keyword"];
//must have $ when calling a variable, everytime
echo "<h2>All the items with $keywordfromform </h2>";
//SELECT to get data out of the database
$sql = "SELECT ItemID, Item_Name, Item_Price FROM price_table WHERE Item_Name LIKE '%" . $keywordfromform . "%'";
$result = $mysqli->query($sql);
?>
<div id="accordion">
<?php
while($row = $result->fetch_assoc()) {
//echo "ItemID: " . $row["ItemID"]. " - ItemName: " . $row["Item_Name"]. " - ItemPrice: $row["Item_Price"]. "<br>";
echo "<h3> $row["ItemID"] </h3>";
echo "<div><p> $row["Item_Name"] </p></div>";
}
?>
</div>
<a href ="index.php">Return to main page</a> <!-- go back to the main page-->