PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
First of all, I just picked up PHP and SQL out of necessity for a new site. What I've learned so far has amazed me. I'm having a little hiccup, though. I'm using PHP to execute queries to an item database and "echo"ing the html code to set the returns in a table. The method I'm using, though, is only allowing one cell per table row. I'd like to have the items displayed two-per-row. I've tried to manipulate the code a little, but have yet to find a solution. The example code below is returning the results in a single table row. Any ideas on how to drop in a </tr><tr> after every two results?
echo '<table>
<tr>';
$i = 0;
while (...)
{
if ($i == 2)
{
echo '</tr><tr>';
$i = 0;
}
//your normal table code here
$i++;
}
echo '</tr>
</table>';
That should take care of it.
Please use the [ php ] and [ code ] BBCode tags when posting code in the forums. =]
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.