it says syntax error t_else, what could be the problem?
它真的让我疯狂找到我在这段代码中做错了什么 什么可能是我的错误在这里?嵌套如果其他语法错误php
<?php
include("../mysql_connect.php");
if (isset($_POST['search_form'])) {
$page1 = $_GET['page'];
if ($page1 == "" || $page1 == 1) {
$page1 = 0;
}
else {
$page1 = ($page1 * 5) - 5;
}
$query = "select * from tbl_news where news_title like '$_POST[search]' || news_author like '$_POST[search]' ";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
?>
<table class="table table-hover" border="2">
<col width="50%"></col>
<col width="40%"></col>
<col width="20%"></col>
<tr>
<td rowspan="3">
a href="news_view.php?id=<?php echo $row['news_id']; ?>">
<img src="<?php echo $row['news_image_location'] . $row['news_image']; ?>" height="300" width="500">
</a>
</td>
<td>Title: <?php echo $row['news_title']; ?></td>
</tr>
<tr>
<td>Author: <?php echo $row['news_author']; ?></td>
</tr>
<tr>
<td>Date: <?php echo $row['news_date_filed']; ?></td>
</tr>
</thead>
</table>
<?php
}
$query1 = "select * from tbl_news where news_title like '$_POST[search]' || news_author like '$_POST[search]'";
$result1 = mysql_query($query1);
$row1 = mysql_num_rows($result1);
$pagecount = $row1/5;
$pagecount = ceil($pagecount);
for ($count = 1; $count <= $pagecount; $count++) {
?>
<a href="news.php?page=<?php echo $count; ?>"><?php echo $count ?></a>
<?php
}
}
else{
$page1 = $_GET['page'];
if ($page1 == "" || $page1 == 1) {
$page1 = 0;
}
else {
$page1 = ($page1 * 5) - 5;
}
$query = "select * from tbl_news where news_status='Active' limit $page1,5";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
?>
<table class="table table-hover" border="2">
<col width="50%"></col>
<col width="40%"></col>
<col width="20%"></col>
<tr>
<td rowspan="3">
<a href="news_view.php?id=<?php echo $row['news_id']; ?>">
<img src="<?php echo $row['news_image_location'] . $row['news_image']; ?>" height="300"
width="500">
</a>
</td>
<td>Title: <?php echo $row['news_title']; ?></td>
</tr>
<tr>
<td>Author: <?php echo $row['news_author']; ?></td>
</tr>
<tr>
<td>Date: <?php echo $row['news_date_filed']; ?></td>
</tr>
</thead>
</table>
<?php
}
?>
<?php
$query1 = "select * from tbl_news where news_status='Active'";
$result1 = mysql_query($query1);
$row1 = mysql_num_rows($result1);
$pagecount = $row1/5;
$pagecount = ceil($pagecount);
for ($count = 1; $count <= $pagecount; $count++) {
?>
<a href="news.php?page=<?php echo $count; ?>"><?php echo $count ?></a>
<?php # code...
}
}
?>
这里是完整的代码,什么errror给我,请帮我人需要我一大把的有这样那样的问题,我已经尝试了所有我能时间,但也许你们可以我解决我的问题hahahaha它在这里真的让我心动不已,我已经对我目前面临的问题非常头疼
mysql_ *函数自PHP 5.5.0起弃用,自PHP 7.0.0起删除。切换您的代码以使用[PDO](https://secure.php.net/manual/en/pdo.prepared-statements.php)或[mysqli](http://php.net/manual/en/mysqli。改为quickstart.prepared-statements.php)。 – aynber
取出你的关闭if括号和else语句之间的'?><?php'。当你打破这样的控制时,PHP不喜欢它。 – aynber
难怪有一个错误。我永远无法跟踪所有的开放和关闭标签。你知道这个错误在哪里吗?什么线? – Andreas