I've got in my database for example 7 columns with 5 rows (ID,title , date,text,img), I want to get title and img from the last three colums and i did this:
<?$queryT = "SELECT * FROM mainpage ORDER BY ID DESC LIMIT 1";
$resultT = mysql_query($queryT) or die(mysql_error()."[".$queryT."]");
$queryI = "SELECT * FROM mainpage ORDER BY ID DESC LIMIT 1";
$resultI = mysql_query($queryI) or die(mysql_error()."[".$queryI."]");
?>
<?while ($rowT = mysql_fetch_array($resultT, MYSQL_BOTH)){
while ($rowI = mysql_fetch_array($resultI, MYSQL_BOTH)){
?>
<ul class="bjqs">
<li><img src="<?php echo $rowI["IMG"]; ?>" title="<?php echo $rowT["TITLE"]; ?>" class="siderNews"></li>
<li><img src="<?php echo $rowI["IMG"]; ?>" title="<?php echo $rowT["TITLE"]; ?>" class="siderNews"></li>
<li><img src="<?php echo $rowI["IMG"]; ?>" title="<?php echo $rowT["TITLE"]; ?>" class="siderNews"></li>
</ul>
<?
}
}
?>
but it's printing me , three times the information from the last column only. I use and print that information in a slider.