Dragonspell
09-07-2002, 11:52 PM
OK, here's my problem.
I've got a MySQL-table with several fields (fake1,fake2,test1,test2,test3,fake3). Now, I do only want to get the fields test1,test2,test3, but I only know by an Integer, how may there are (because the number of fields increases from time to time, so there will be test4, test5,..., test100 in near future etc).
With Non-Arrays (integer for example, $Test1, $Test2, $Test3 etc), I normaly would use something like this:
for ($i=1;i<=$number_of_testfields;i++){
print ("${"test".$count}");
}
With arrays it should look somthing like this, but I can't get this example work (PHP doesn't like the 3rd line):
$data=$DB_site->query_first("SELECT * FROM Testtable");
for ($i=1;$i<=$number_of_testfields;$i++){
print ("$data[test".$i."]");
}
I hope you understood my problem. Thanx for your help.
I've got a MySQL-table with several fields (fake1,fake2,test1,test2,test3,fake3). Now, I do only want to get the fields test1,test2,test3, but I only know by an Integer, how may there are (because the number of fields increases from time to time, so there will be test4, test5,..., test100 in near future etc).
With Non-Arrays (integer for example, $Test1, $Test2, $Test3 etc), I normaly would use something like this:
for ($i=1;i<=$number_of_testfields;i++){
print ("${"test".$count}");
}
With arrays it should look somthing like this, but I can't get this example work (PHP doesn't like the 3rd line):
$data=$DB_site->query_first("SELECT * FROM Testtable");
for ($i=1;$i<=$number_of_testfields;$i++){
print ("$data[test".$i."]");
}
I hope you understood my problem. Thanx for your help.