I have PHP code which fetching images from database with <td>
tags. I would like to display two pictures in row, any advice how to add <tr>
after every second <td>
using jQuery?
public function homepage_gall($panel){
//Fetching photos from database,to create photo gallery called in homepage.php
$sql="SELECT name FROM photos LIMIT 6";
$this->query($sql);
while($row=$this->result->fetch_array(MYSQLI_ASSOC)){
$this->name=$row['name'];
// Making different path,depends on place where function is called,panel.php or homepage.php
if($panel){
echo "<td><img src=\"../uploaded_images/".$this->name."\"/></td>";
}
else{
echo "<td><img src=\"uploaded_images/".$this->name."\"/></td>";
}
}
}
I don't know why you want to use jQuery on this but I would add a table and handle all tr and td in PHP as you already do. Replace your whole code with the following if you want that: