Php 语法错误,意外'';(T_包含_和_空格),应为标识符
用大括号将其包裹起来:Php 语法错误,意外'';(T_包含_和_空格),应为标识符,php,html,mysql,Php,Html,Mysql,用大括号将其包裹起来: <?php while ($row = $result->fetch_assoc()) { echo "<input type =\"submit\" name=\"naam\" value=\"$row['naam']\">"; } $result->free(); ?> 检查 最适合我的解决方案: $row['naam'] = htmlspecialchars($row['naam']); 你需要使用。因为您希望将“”
<?php
while ($row = $result->fetch_assoc()) {
echo "<input type =\"submit\" name=\"naam\" value=\"$row['naam']\">";
}
$result->free();
?>
检查
最适合我的解决方案:
$row['naam'] = htmlspecialchars($row['naam']);
你需要使用。因为您希望将“”与$row['naam'的值连接在一起
$naam_value = htmlspecialchars($row['naam']);
echo”“;
您的代码与\和双引号匹配
用途:-
echo "<input type =\"submit\" name=\"naam\" value=\".$row['naam'].\">";
echo”“;
echo';
字符串中有问题:请重试
@XavierVanVinken当然很高兴这有帮助,当然,另一种方法是将它放在一起,而不是连接起来。但是要小心,如果$row['naam']
包含一些双引号,它肯定会破坏该属性并提前终止它
while ($row = $result->fetch_assoc()) {
echo '<input type="submit" name="naam" value="'.$row['naam'].'">';
}
$naam_value = htmlspecialchars($row['naam']);
echo "<input type =\"submit\" name=\"naam\" value=\".$row['naam'].\">";
echo "<input type ='submit' name='naam' value='".$row['naam']."'>";
echo '<input type ="submit" name="naam" value="' . $row['naam'] . '">';
<?php
while ($row = $result->fetch_assoc()) {
echo "<input type ='submit' name='naam' value='".$row['naam']."'>";
}
$result->free();
?>