phplearnerguy — 2012-09-18T12:11:48-04:00 — #1
I have written a class for printing mysql query result to html table. There is no syntex error. it works very file. but there is one logical error. and that is in htmltable function. It prints one row less than the actual rows. it misses the very first row which is to be printed. error may be somewhere around while loop. please help me find the error. I tested it in all possible ways from my side.
code is available at pastebin
cpradio — 2012-09-18T12:52:30-04:00 — #2
You made a very easy mistake, you are calling mysql_fetch_assoc() prior to your while loop, which moves the cursor to the next row, instead use mysql_field_name.
Pastebin updated: http://pastebin.com/vLxvwkkp
phplearnerguy — 2012-09-18T13:04:12-04:00 — #3
Issue resolved. I was struggling all round while loop.
It was a simple class to display to result to html table using class. I wanna extend it now.
Possible addition may be.
1. Adding extra clickable column to table rows action queries.
2. Adding alternate row css class for alternate row colors.
3. Table header row css class for styling.
and may be few other functions so that this class can be used in almost any project. All forum members are invited to suggets or contributes to this generic class. It may be useful to many.