• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP Help needed

bozley05

NLC
NLC
Ok, what I need is some way of making a dynamic table (like making a table from mysql using the while statement) that will make a specific amount of rows from a "number of rows" variable and then keep count of what row it is on, so when it gets to the last $no_of_rows it will close off the table.

I think this would use a foreach or something, I'm not quite sure...

Any help would be appreciated.
 
I think you might want something like this:

PHP:
<? 
for ($x=1;$x==$num_of_rows;$x++)
{
SQL STATEMENTS GO HERE
}
?>

That might not be it, as I don't really understand what you need.
 
I am actually working with the Directi API, an I want to list the customers domains. It returns them like $result["1"]["$entityname"] , $result["2"]["$entityname"] and so on.. Along with the $result["numbrecs"] or whatever it is called.
 
PHP:
echo '<table>';
for ($i = 1; $i <= $num; $i++)
     echo '<tr><td>'.$result[$i][$entityname].'</td></tr>';
echo '</table>';

?
 
That looks like it will work :) Thanks for the help kab and tree..

I will try it later. If you don't here back from me, you know it has worked ;)
 
Back
Top