I know how to do a loop for each row in the DB.
What I need to do is make a loop for each column of a DB table, if I do not know how many column there will be.
so that it run the code for every column in the table like I did with the rows.
Code: Select all
$sel="select * from lqlotl.inventory where lqlotl.inventory.charid='$charid' ";
$result=mysql_query($sel) or die("could not select Race");
$num_rows = mysql_num_rows($result);
while ($result2 = mysql_fetch_array($result)) {
some code
$name =$result2[name];
}
Lets say I have Table of skills called skill, each row holds the info of one skill, the column are id name type and so on.
what I need to do is to create a charskills table on the fly or at start up, from the skills table.
So charskill table will have the column id then a number of column for each rows of the skills table, so that the name of each skill is the heard of each column.
I have no idea on how to do this at all if I do not know the amount of rows before hand?
would love some help with this.
cheers