Database variable table spliting
Posted: Sun Jul 15, 2007 11:04 am
Hi all,
The above is code i have developed to display information from a database, for security reasons i have removed all information relating to the database and replaced it with dummy information.
I am wanting to to split variable information into serpate tables, ie if variable contained info1 na dinfo2 it would split info1 into a serpate table and info2 into a another table.
Eventally i would want it to split the variable into serpate pages with links ot them and i would want variable2 to be split the same way after variable1
What sort of function will i require? i have a fair idea it will be very omplex code
Code: Select all
<?php
mysql_connect("database", "username", "password") or die(mysql_error());
mysql_select_db("databasename") or die(mysql_error());
$query="select * from table";
mysql_query($query);
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
$i=0;
echo"<center><table border=1><tr>";
echo "<td>Variable1</td>";
echo "<td>Variable2</td>";
echo "<td>Variable3</td>";
echo "<td>Variable4</td>";
while ($i < $num)
{
$variable1=mysql_result($result,$i,"variable1");
$variable2=mysql_result($result,$i,"variable2");
$variable3=mysql_result($result,$i,"variable3");
$variable4=mysql_result($result,$i,"variable4");
echo "<tr><td>$variable1</td><br>";
echo "<tr><td>$variable2</td><br>";
echo "<tr><td>$variable3</td><br>";
echo "<tr><td>$variable4</td><br>";
$i++;
}
echo "</table></center></font>";
?>I am wanting to to split variable information into serpate tables, ie if variable contained info1 na dinfo2 it would split info1 into a serpate table and info2 into a another table.
Eventally i would want it to split the variable into serpate pages with links ot them and i would want variable2 to be split the same way after variable1
What sort of function will i require? i have a fair idea it will be very omplex code