I'm trying to get this piece of code to display the variable $variable as a number which is calling from a database.
There are categories that contain sub categories, these categories are displayed with the number of sub categories next to it (the dynamically generated number)
e.g. Category: Gaming (4)
The bit in the brackets is the dynamically generated number.
Here is the code, I can only get it to display like this:
Windows Doors Conservatories (Array)
<?php
mysql_connect("", "", "") or die(mysql_error());
mysql_select_db("testing") or die(mysql_error());
$data = mysql_query("SELECT * FROM categories2");
$subno = mysql_query("SELECT COUNT(*) FROM subcategories WHERE keyword = 'Windows'")
or die(mysql_error());
Print "<table>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<td>".$info['username'] . "</td> ";
}
while($variable = mysql_fetch_array( $subno ))
{
Print "<td>(".$variable . ") </td></tr>";
}
Print "</table>";
?>
Thanks in advance!