I have a table "data" , in that I have a column "name" there are many names saved in name column in the table name "data" NOW what I want is print out the record some thing like this but using PHP mysql_fetch_array()
and loop through it. (while loop)
Results:
<table>
<tr>
<td>name</td><td>name</td>
</tr>
</table>
Edit: Here is my current code -
<ul class="spa1" style="margin-left:5px">
<?php
$img= mysql_query("SELECT * FROM immi");
while ($row=mysql_fetch_array($img)){
echo "<li><a href='PracticeArea.php?cat=ts&id=".$row['id']."'>".$row['name']."</a></li>";
}?>
</ul>
and what I want is something like this:
<ul class="spa1" style="margin-left:5px">
<?php
$img= mysql_query("SELECT * FROM immi");
while ($row=mysql_fetch_array($img)){
echo "<li><a href='PracticeArea.php?cat=ts&id=".$row['id']."'>".$row['name']."</a></li>
<li><a href='PracticeArea.php?cat=ts&id=".$row['id'] + 1."'>".$row['name']."</a></li>
";
}?>
<table><tr>
<?php
$i = 0;
$img = mysql_query("SELECT * FROM immi");
while ($row=mysql_fetch_array($img)) {
if (($i % 2) == 0 && $i > 0) echo '</tr><tr>';
echo "<td><a href='PracticeArea.php?cat=ts&id=".$row['id']."'>".$row['name']."</a></td>";
++$i;
}
if (($i % 2) == 1) echo '<td> </td>';
?>
</tr></table>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.