Forum Moderators: coopster
<tr><td>Row1</td> <td>Row2</td> <td>Row3</td></tr>
Then it would notice three entries are up and do the next three,
<tr><td>Row4</td> <td>Row5</td> <td>Row6</td></tr>
Then again,:
<tr><td>Row7</td> <td>Row8</td> <td>Row9</td></tr>
Until all the entries are used up. I am not good at arrays at all, and would not know at all how to accomplish this. But the sql would be "Select * from screen_saver where category_id=1 order by name desc". Thanks for your help.
Select fieldname from screen_saver where category_id=1 order by name desc
then you can load each value into an array using mysql_fetch_array [ca.php.net]
something like
$q = "Select fieldname from screen_saver where category_id=1 order by name desc";
$result = mysql_query($q);
while ($row = mysql_fetch_array($result)) {
$rowarr[] = $row['fieldname'];
}
at this point you will need to populate your table with the data. Does the number of rows change? If so you could look at this to dynamically build a table
$current_cell = 1;
$maxcells = 4;
$counter = 0;
echo "<table>";
while (is_array($rowarr[$counter])) { //not sure if this is the best test maybe!empty or!isset
if ($current_cell == 1) echo "<tr>";
echo "<td>",$rowarr[$counter],"</td>";
if ($current_cell == 4) {
echo "</tr>";
$current_cell = 1;
} else {
$current_cell++;
}
$counter++;
}
switch ($current_cell) {
case 2:
echo "<td> </td>";
case 3:
echo "<td> </td>";
case 4:
echo "<td> </td>";
echo "</tr>";
break;
}
echo "</table>";
HTH
Ok I have like 30 rows of info, where only 3 field needs to be in table. The table goes by threes in 2's in <td>s before it needs to start a new tr.
<tr><td>Row1</td> <td>Row2</td> <td>Row3</td></tr>
Then it would notice three entries are up and do the next three,
<tr><td>Row4</td> <td>Row5</td> <td>Row6</td></tr>
Then again,:
<tr><td>Row7</td> <td>Row8</td> <td>Row9</td></tr>
Until all the entries are used up. I am not good at arrays at all, and would not know at all how to accomplish this. But the sql would be "Select * from check_mark order by name.
Here is one example of a td:
<INPUT type=checkbox value= $value
name=$call_name>$name
So for each row inside a td will be this information. Thanks alot for any who decide to help me.