10 มิถุนายน 2556

custom accordion jquery

Margin and Padding

Try applying margin-bottom:5px; to .ui-accordion-header.
This will cause a gap between the open header and it's content, but you can fix that by removing the margin on .ui-accordion-header.ui-state-active and applying it to .ui-accordion-content-active instead.
So your css would look like this:
.ui-accordion-header {
margin-bottom:5px;
}
.ui-accordion-header.ui-state-active {
margin-bottom:0;
}
.ui-accordion-content-active {
margin-bottom:5px;
}

That might need a bit of tweaking, but should get you mostly there.

อ้างอิง http://stackoverflow.com/questions/3229723/jquery-ui-accordion-issue

สำหรับทดสอบ script online
http://jsbin.com/adele3/687/edit 

Extending Jquery accordion to rows of a table
http://stackoverflow.com/questions/16046654/extending-jquery-accordion-to-rows-of-a-table

8 พฤษภาคม 2556

Simple export php to excel
  1. $result=mysql_query("select * from tbl_name");
  2. function xlsBOF()
  3. {
  4. echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
  5. return;
  6. }
  7. function xlsEOF()
  8. {
  9. echo pack("ss", 0x0A, 0x00);
  10. return;
  11. }
  12. function xlsWriteNumber($Row, $Col, $Value)
  13. {
  14. echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
  15. echo pack("d", $Value);
  16. return;
  17. }
  18. function xlsWriteLabel($Row, $Col, $Value )
  19. {
  20. $L = strlen($Value);
  21. echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
  22. echo $Value;
  23. return;
  24. }
  25. header("Pragma: public");
  26. header("Expires: 0");
  27. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  28. header("Content-Type: application/force-download");
  29. header("Content-Type: application/octet-stream");
  30. header("Content-Type: application/download");;
  31. header("Content-Disposition: attachment;filename=list.xls");
  32. header("Content-Transfer-Encoding: binary ");
  33. xlsBOF();
  34. xlsWriteLabel(0,0,"Heading1");
  35. xlsWriteLabel(0,1,"Heading2");
  36. xlsWriteLabel(0,2,"Heading3");
  37. $xlsRow = 1;
  38. while($row=mysql_fetch_array($result))
  39. {
  40. xlsWriteNumber($xlsRow,0,$row['field1']);
  41. xlsWriteLabel($xlsRow,1,$row['field2']);
  42. xlsWriteLabel($xlsRow,2,$row['field3']);
  43. $xlsRow++;
  44. }
  45. xlsEOF();

22 เมษายน 2556

import csv to mysql with php


# Author: Keegan
# Email: keegan@sifizm.com
# Web Site: www.sifizm.com

# I run this script from a cron job every night to update
# the mysql database I use with my employee web site
# so it matches my local database every day. Feel free to
# modify it to meet your specific needs. If you find it
# usefull, drop me an email and let me know.

# edit the follow six items to use the script

# first connect to your mysql database
# i have my connection settings in a diferent file
# so i just include that file in all my scripts
include("db.php");

# assign the tables that you want to import to to the table array
$table = array(
'table1',
'table2',
'table3',
'table4',
'table5',
);

# if the first row of your csv file contains column headings:
# $columnheadings=1
# if the first row does not contain column headings and should be imported:
# $columnheadings=0
$columnheadings = 0;

# contains the email address you want the results sent to
$emailaddress = "user@domain.com";

# contains the subject you want the message to have
$subject = "Enter Subject Here";

# contains the email address that will show in the from line
$emailfrom = "user@domain.com";

# you should not have to edit anything below this line



# perform the required operations for every table listed in the table array
foreach ($table as $tablename) {

# empty the table of its current records
$deleterecords = "TRUNCATE TABLE `$tablename`";
mysql_query($deleterecords);

# intialize your counters for successful and failed record imports
$pass = 0;
$fail = 0;

# the csv file needs to be the same name as the table,
# comma seperated with the columns in the same order as the table,
# and in the same dir as this script
$filecontents = file ("$tablename.csv"); # .csv is added to the table name to get the name of the csv file

# every record in the csv file will be inserted into the table unless an error occurs with that record
for($i=$columnheadings; $i$insertrecord = "Insert Into `$tablename` Values ($filecontents[$i])";
mysql_query($insertrecord);
if(mysql_error()) {
$fail += 1; # increments if there was an error importing the record
}
else
{
$pass += 1; # increments if the record was successfully imported
}
}

# adds a line to the email message we will send stating how many records were imported
# and how many records failed for each table
$message .= "Table $tablename: Success=$pass Failure=$fail \n";
}

# set to the date and time the script was run
$runtime = (date("d M Y H:i"));

# add the run time to the body of the email message
$message .= "\nTime of the message: $runtime (server time zone)\n\n";

# Send the email message
mail($emailaddress, $subject, $message, "From: '$emailfrom'");

?>

17 ธันวาคม 2555

การ setting ค่า memory php โดยใช้ .htaccess

http://www.pacecode.com/blog/2008/09/22/magic-with-htaccess-file-increase-execution-time-session-expiry-time-and-file-upload-size-limit/


การแสดงค่าหน่วยความจำที่ใช้ไปของ php  echo memory_get_usage()