Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<?php 

include("admin/config/db.php");
?>
<div class="col-md-4">
<div class="side">
<div class="side_main">
<span>Latest Post</span></div>
</div><br>
<?php

$select="select * from news order by id Desc limit 0,4";
$run=mysqli_query($con,$select);
$count=mysqli_num_rows($run);
if(count>0){

while($row=mysqli_fetch_array($run)){
	
	$id=$row['id'];
	$name=$row['Name'];
	$img=$row['Image'];


?>
<div class="row">

<div class="col-md-4"><br><img src="admin/<?php echo $img?> " class ="img img-rounded" style="width:120px; height:120px; border:1px solid;"><br><br></div>

<div class="col-md-4"><span class="side_post"><a href="viewnews.php?id=<?php echo $id?>"><?php echo $name?></a></div>
</div></div><hr>
<?php}}
else{
	
echo "<center><h5>Sorry No Post Available </h5></center>";
}
?>
<div class="col-md-4">

<div class="side">
		<div class="side_main">
			<span>Categories</span>
</div>
<div class="cat">
	<?php  

$cat="select * from cat order by id desc";
$run_cat=mysqli_query($con,$cat);
$count_cat=mysqli_num_rows($run_cat);
if($count_cat>0){

	while($row=mysqli_fetch_array($run_cat)){

		$id_cat=$row_cat['id'];
		$name_cat=$row_cat['Name'];

		?>
	<a href="all.php?id=<?php echo $id_cat ?>"><?php echo $name_cat ?> </a>
	<?php }}


	else{

echo "<center><h5>Sorry No Categories Available </h5></center>";

	}


	?>
</div>


What I have tried:

Sir, I have tried to solve the problem but I did not find the solution so, please help me all to solve my problem I have mentioned the code below. I am getting the error Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\IIHH\include\side.php on line 70
Posted
Updated 22-Oct-19 5:27am
v2
Comments
Luc Pattyn 22-Oct-19 17:19pm    
Hmm. I don't like your formatting much (spacing, indentation), it just makes it all very hard to read. I did notice a <php{ where IMO a space would be required in between. You also have an if(count without a $. I doubt these would generate the error you're getting, but then the problem may well be in the included file. A missing } is what I suspect.
Mohibur Rashid 22-Oct-19 17:42pm    
Your source code has many issues.

1. format
2. count in if condition is
if(count>0){

3. You have this kind of format
/* no issue here; just keeping consistent format is suggested. */
/*  */
<?php echo $img?>
<?php echo $img;?>

/* Alternative */
<?=$img?>



You have included
 
include("admin/config/db.php");


Can you please make sure your admin/config/db.php is ok?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900