10

report generate from database into text file

view full story
linux-howto

http://www.daniweb.com – Hello all I am trying to do--Attendance of the month march and i want format for text file is like employeecode 1 2 3 4 5 6 7 8------30 E01 A P P P p P P P E02 -- -- -- I m using mysql database. My tables for this is : for employee code at0310..... for dates m using table mar10 but for employee present and absent i need to print it by coding but couldnt understand how to do it......plz help me out .. the code dat i m using is not correct......... dat display date and ecode but ecode is correct like shown above but dates are not like dat and how i dont hw print A and P .... <? $myFile = "att.txt"; $conn = mysql_connect("localhost", "root", "root") or die("Could not connect: ".mysql_error()); mysql_select_db("master",$conn) or die("Could not select db: " . mysql_error()); $fhandle = fopen($myFile, 'w') or die("Error opening file."); $res = mysql_query("SELECT emp_company.ecode, mar10.Date FROM emp_company,mar10 "); ) while ($row = mysql_fetch_assoc($res)) fwrite ($fhandle, "{$row['ecode']}\t {$row['Date']}\t \r\n"); fclose($fhandle); echo "Report Generated "; ?> (General)