Jump to content

chelnov63

Members
  • Posts

    117
  • Joined

  • Last visited

    Never

Everything posted by chelnov63

  1. hi guys i want to return only the last 180 records of a recordset (but i want to keep the id in ASC order): $selectSQL = "SELECT * FROM messages ORDER by id ASC"; $rs = mysql_query($selectSQL,$conn); is there anyway to do this? thanks in advance
  2. anyone? :'(
  3. Hi everyone I am using the code (which can also be seen at http://www.phpsimple.net/tutorials/mysql_to_excel/ ): <? // Connect database. mysql_connect("localhost","",""); mysql_select_db("tutorial"); // Get data records from table. $result=mysql_query("select * from name_list order by id asc"); // Functions for export to excel. function xlsBOF() { echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0); return; } function xlsEOF() { echo pack("ss", 0x0A, 0x00); return; } function xlsWriteNumber($Row, $Col, $Value) { echo pack("sssss", 0x203, 14, $Row, $Col, 0x0); echo pack("d", $Value); return; } function xlsWriteLabel($Row, $Col, $Value ) { $L = strlen($Value); echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L); echo $Value; return; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download");; header("Content-Disposition: attachment;filename=orderlist.xls "); header("Content-Transfer-Encoding: binary "); xlsBOF(); /* Make a top line on your excel sheet at line 1 (starting at 0). The first number is the row number and the second number is the column, both are start at '0' */ xlsWriteLabel(0,0,"List of car company."); // Make column labels. (at line 3) xlsWriteLabel(2,0,"No."); xlsWriteLabel(2,1,"Company"); $xlsRow = 3; // Put data records from mysql by while loop. while($row=mysql_fetch_array($result)){ xlsWriteNumber($xlsRow,0,$row['id']); xlsWriteLabel($xlsRow,1,$row['name']); $xlsRow++; } xlsEOF(); exit(); ?> to export from a mysql db to an excel file. All is working fine. However how do I change the colour of the rows and font size of the text in the excel file? Any ideas? thanks in advance. Cheers
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.