php-parse错误:语法错误,意外的'readphp'(t_string),应为','或';'

csbfibhn  于 2021-06-21  发布在  Mysql
关注(0)|答案(2)|浏览(319)

我正试图从 mysql 正在使用此模板,但它不起作用,我无法在以下代码中找到错误:

<?php
$connection = mysql_connect("localhost", "root", ""); // Establishing Connection with Server
$db = mysql_select_db("company", $connection); // Selecting Database
//MySQL Query to read data
$query = mysql_query("select * from employee", $connection);
while ($row = mysql_fetch_array($query)) {
echo "<b><a href="readphp.php?id={$row['employee_id']}">{$row['employee_name']}</a></b>";
echo "<br />";
}
?>

我得到以下错误:

Parse error: syntax error, unexpected 'readphp' (T_STRING), expecting ',' or ';'
jbose2ul

jbose2ul1#

更改href url的“to”。它与开放逗号冲突。

echo "<b><a href='readphp.php?id={$row['employee_id']}'>{$row['employee_name']}</a></b>";

<?php
$connection = mysql_connect("localhost", "root", ""); // Establishing Connection with Server
$db = mysql_select_db("company", $connection); // Selecting Database
//MySQL Query to read data
$query = mysql_query("select * from employee", $connection);
while ($row = mysql_fetch_array($query)) {
echo "<b><a href='readphp.php?id={$row['employee_id']}'>{$row['employee_name']}</a></b>";
        echo "<br />";
}
?>
ac1kyiln

ac1kyiln2#

你必须逃跑 " 当在其他引号内时 " . 更改: echo "<b><a href="readphp.php?id={$row['employee_id']}">{$row['employee_name']}</a></b>"; 收件人: echo "<b><a href=\"readphp.php?id={$row['employee_id']}\">{$row['employee_name']}</a></b>";

相关问题