include "XXconnection.php";
$result = mysqli_connect($host,$uname,$pwd) or die("Could not connect to database." .mysqli_error());
mysqli_select_db($result,$db_name) or die("Could not select the database." .mysqli_error());
$image_query = mysqli_query($result,"SELECT img_name,img_path, img_dept from image_table order by img_dept");
while($rows = mysqli_fetch_array($image_query))
{
$img_name = $rows['img_name'];
$img_src = $rows['img_path'];
$img_dept = $rows['img_dept'];
$name_ar = explode(', ', $img_name);
?>
<?php
if ( $img_dept == 'mercedes') {
?>
<div style="float:left;width:420px;border:1px solid #06F;background:#f8fdfd;padding:5px;margin-left:5px;margin-right:5px;margin-top:5px;margin-bottom: 10px;border-radius:10px 10px 0px 0px;color:#039;">
<h3><?php echo $img_dept; ?></h3>
<?php
foreach ($name_ar as $value) {
?>
<b style="font-size:14px;padding-top: 24px;">»</b>
<a href="<?php echo $img_src; ?>"><?php echo $value; ?></a>
<?php
}
?>
</div>
<?php
}
?>
<?php
}
?>
</div>
</div>
</div>
that is my code so far. I know this is wrong. How can I seperate my content and its topic. Eg: if the Apple is a topic, then Red and Green are its content. If Banana is a topic, then Yellow, Green, Red will be its content.
So how can I fetch those seperatly under the topic with it's content.
Aucun commentaire:
Enregistrer un commentaire