简体   繁体   English

语法错误,意外的T_ECHO,期望为','或';' 在第110行的/Secured_Page_Edit.php中

[英]syntax error, unexpected T_ECHO, expecting ',' or ';' in /Secured_Page_Edit.php on line 110

<?php

session_start();

if (!isset($_SESSION['username'])) {
header('Location: LoginForm.php');
}

?>

<html>


<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Secured Page</title>

<style>
.db-table {position:absolute;top:95px;left:300px;}
</style>

</head>
<body>

<p align="left" style="margin-left:0px; margin-top:135px;">          
<form action="Secured_Page_Search.php" method="post">
Select_Table_To_Display:<br><select name="Table">
<option value="members">Members</option>
<option value="online">Online</option>
<input type="submit" name="submit_name" />

            </form>

<title>Secured Page</title>
<style type="text/css">
body{font-family:Impact;}                                    
#container{width:10000px;margin:auto;font-size:15pt;}

#menu{position:absolute;margin-top:10px;}
#menu ul .item{display:none;}
#menu ul:hover .item{display:block;background:#white;padding:1px;margin:1px;}

#menu ul:hover .item a{color:#abc;text-decoration:none;}
#menu ul:hover .item a:hover{color:grey;}

#menu ul{width:110px;float:left;margin:0px;padding:2px;background:white;list-

Style:none;}
.clear{clear:both;height:10px;}
</style>


<div id="container">
<h1></h1>

<div id="menu">

<p align="left" style="margin-left:0px; margin-top: 0px;">
<br><FONT FACE="arial">Logged In @: (<?php echo $_SESSION['username']; ?>)</FONT></p>
</p>

<ul id="item1">
<li class="top">Profile</li>
<li class="item"><a href="#">Profile User</a></li>
<li class="item"><a href="#">Profile I.M.</li>
<li class="item"><a href="#">Profile O.P.</a></li>
</ul>

<ul id="item1">
<li class="top">Edit</li>
<li class="item"><a href="#">Edit User</a></li>
<li class="item"><a href="#">Edit I.M.</li>
<li class="item"><a href="#">Edit O.P.</a></li>
</ul>

</div>
<div class="clear"></div>

</body>


<br><FONT FACE="arial">


<?php

$Table = 'members';

$mysqli = new mysqli("XXXXXXXX", "XXXXXXXX", "XXXXXXXX", "XXXXXXXXXX");
$result = $mysqli->query("SHOW TABLES");
while ( $row = $result->fetch_row() ){
$table = $row[0]; 
$result1 = $mysqli->query("SELECT * FROM $Table ORDER BY dt DESC LIMIT 0,12");
if($result1) {
echo '<table cellpadding="15" cellspacing="20" class="db-table">';
$column = $mysqli->query("SHOW COLUMNS FROM $Table");echo '<tr>';
while($row3 = $column->fetch_row() ) {
echo '<th>'.$row3[0].'</th>';
}
echo '</tr>';
while($row2 = $result1->fetch_row() ) {
echo '<tr>';
foreach($row2 as $key=>$value) {
LINE 110 ----> echo '<td style="padding-top:0px;padding-bottom:0px;">',$value,'
<a href="edit.php?id=<?' echo $row['id']; '?>">'Edit'</a></td>;'<------Line 110
  }
  echo '</tr>';
}
echo '</table><br />';
}
}
$mysqli->close();

?>

<FONT FACE="impact">

<p align="left" style="margin-left:100px; margin-top:100PX;"> 

<form action="Secured_Page_Search_Email.php" method="post">
Search, Email:<br>                             <input type="text" name="email"><br>
    <input type="submit" name="submit_name" />
            </form>  

<p align="left" style="margin-left:100px; margin-top:10px;">    


<form action="Secured_Page_Search_User.php" method="post">
Search, User:<br>                       <input type="text" name="usr"><br>
    <input type="submit" name="submit_name" />
            </form>              

</FONT></p>
</body>
</html>

Basically i need the mysql table to print with a edit link... Seems so easy, but have been battling with this issue the last few hours. 基本上,我需要mysql表才能通过编辑链接进行打印...似乎很简单,但最近几个小时一直在解决此问题。 Line that has an issue: 存在问题的行:

Basically i need the mysql table to print with a edit link... Seems so easy, but have been battling with this issue the last few hours. 基本上,我需要mysql表才能通过编辑链接进行打印...似乎很简单,但最近几个小时一直在解决此问题。 Line that has an issue: 存在问题的行:

LINE 110 ----> echo '<td style="padding-top:0px;padding-bottom:0px;">',$value,'
<a href="edit.php?id=<?' echo $row['id']; '?>">'Edit'</a></td>;'<------Line 110

UPDATED CODE UPDATED CODE 更新的代码更新的代码

echo '<td><a href="edit.php?id='.$row['id'].'">'Edit'</a></td>;'

Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' 解析错误:语法错误,意外的T_ECHO,期望为','或';' in Secured_Page_Edit.php on line 113 在第113行的Secured_Page_Edit.php中

echo '<td style="padding-top:0px;padding-bottom:0px;">'.$value.'
<a href="edit.php?id='.$row['id'].'">Edit</a></td>';

The way you concatenate text and variables is wrong. 连接文本和变量的方式是错误的。 See http://php.net/manual/en/language.operators.string.php 参见http://php.net/manual/en/language.operators.string.php

You should write something like this: 您应该这样写:

LINE 110 ----> echo '<td style="padding-top:0px;padding-bottom:0px;">' . $value . '
<a href="edit.php?id='. $row['id'] .'">Edit</a></td>;'<------Line 110

More precisely, mixing dots and comma is fine, but if you use single quotes with echo, you should make sure to put either a dot or a comma right after them (if you want to continue your string [1]) or a semicolon if you're done [2]. 更精确地讲,混合点和逗号是可以的,但是如果您在回声中使用单引号,则应确保在其后放置一个点或逗号(如果要继续输入字符串[1]),或者将一个分号放在您完成了[2]。

echo 'Text and '.$variable; // [1]
echo $variable.' and text'; // [2]

See also http://us.php.net/manual/en/function.echo.php . 另请参见http://us.php.net/manual/zh/function.echo.php

Your php open/close tags are part of what is being echoed. 您的php打开/关闭标签是正在回显的一部分。 As well as using commas rather then dots (.) to append the $value . 以及使用逗号而不是点(。)附加$value However there is no reason to echo into the html string when already building the string in php. 但是,当已经在php中构建字符串时,没有理由回显html字符串。

echo '<td style="padding-top:0px;padding-bottom:0px;">',$value,'<a href="edit.php?id=<?' echo $row['id']; '?>">'Edit'</a></td>;'

I think you want: 我想你要:

echo '<td style="padding-top:0px;padding-bottom:0px;">'.$value.'<a href="edit.php?id='.$row['id'].'">Edit</a></td>;'
// Changes are:                                       ^         ^              ^                    ^

UPDATE (Thanks Fred) You can in fact use commas to append a string in an echo call. 更新(感谢弗雷德)实际上,您可以使用逗号在回显调用中附加字符串。 So this would also be valid: 因此这也将是有效的:

echo '<td style="padding-top:0px;padding-bottom:0px;">', $value, '<a href="edit.php?id=', $row['id'], '">Edit</a></td>;'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP解析错误:语法错误,意外的T_ECHO - PHP Parse error: syntax error, unexpected T_ECHO in 收到此错误“语法错误,意外的'回声'(T_ECHO),期待';' " 在 Laravel 中创建简单的控制器 - Getting this error "syntax error, unexpected 'echo' (T_ECHO), expecting ';' " in Laravel while creating simple controller 解析错误:语法错误,意外的“回声”(T_ECHO) - Parse error:syntax error,unexpected 'echo'(T_ECHO) html模板php字符串中的一行导致意外的“ echo”(T_ECHO)PHP解析错误 - One line in a html template php string causes unexpected 'echo' (T_ECHO) PHP parse error 为什么这会导致意外的T_ECHO错误? - Why is this resulting in a unexpected T_ECHO error? PHP三元运算符给出了意外的T_echo - PHP ternary operator giving an unexpected T_echo 内联if中的意外标记T_ECHO - Unexpected tag T_ECHO in inline if 解析错误:语法错误,意外的&#39;=&#39;,期望在第33行的DB_driver.php中出现T_FUNCTION - Parse error: syntax error, unexpected '=', expecting T_FUNCTION in DB_driver.php on line 33 的PHP-语法错误,意外的&#39;(&#39;,期待&#39;)&#39; - php - syntax error, unexpected '(', expecting ')' 解析错误:语法错误,意外的&#39;(&#39;,在第26行的-------------- / admin.php中期望T_STRING - Parse error: syntax error, unexpected '(', expecting T_STRING in --------------/admin.php on line 26
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM