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.