Welcome Guest, Not a member yet? Register   Sign In
how to export data to excel and save to certain folder or directory
#1

[eluser]kun kun[/eluser]
i'm new to codeigniter, i wanna make some script to export to excel and save to certain folder in server not download it, such as /home/alamatweb/www/sms

controller
Quote:function toExcelAll() {
$query['data'] = $this->mlogin->toExcelAll();
$this->load->view('excel_view',$query);
}

view
Quote:<?php
$path = "/home/alamatweb/www/sms";
$fullPath = $path."dataku.xls";

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$fullPath);
header("Pragma: no-cache");
header("Expires: 0");
?>
<table border='1' width="70%">
<tr>
<td>NIM</td>
<td>NAMA</td>
<td>No. HP</td>
</tr>
&lt;?php
foreach($data as $item) {
?&gt;
<tr>
<td>&lt;?php echo $item['mhs_nim']?&gt;</td>
<td>&lt;?php echo $item['mhs_nm']?&gt;</td>
<td>&lt;?php echo $item['mhs_hp']?&gt;</td>
</tr>
&lt;?php } ?&gt;
</table>

script for export to excel
Quote:[removed][removed]
[removed]
var wsCount = 3;

$(document).ready(function() {
startCountdown();
});

function startCountdown() {
var url='index.php/login/toExcelAll';

if((wsCount - 1) >= 0){
wsCount = wsCount - 1;
setTimeout(startCountdown, 1000);
}
else{
[removed]=url;
}

}
[removed]

i'm using jquery, why its change to [removed], in jquery, its countdown in 3 seconds, if time up, it will be saved to directory /home/alamatweb/www/sms, but my script download it, how to make it save to the /home/alamatweb/www/sms directory, thanks
#2

[eluser]kun kun[/eluser]
anyone can help ?
#3

[eluser]angeljaky[/eluser]
Hardware implements cache as a block of memory for temporary storage of data likely to be used again. CPUs and hard drives frequently use a cache, as do web browsers and web servers.
A cache is made up of a pool of entries. Each entry has a datum (a nugget (piece) of data) - a copy of the same datum in some backing store. Each entry also has a tag, which specifies the identity of the datum in the backing store of which the entry is a copy.
When the cache client (a CPU, web browser, operating system) needs to access a datum presumed to exist in the backing store, it first checks the cache. If an entry can be found with a tag matching that of the desired datum, the datum in the entry is used instead. This situation is known as a cache hit. So, for example, a web browser program might check its local cache on disk to see if it has a local copy of the contents of a web page at a particular URL. In this example, the URL is the tag, and the contents of the web page is the datum. The percentage of accesses that result in cache hits is known as the hit rate or hit ratio of the cache.
The alternative situation, when the cache is consulted and found not to contain a datum with the desired tag, has become known as a cache miss. The previously uncached datum fetched from the backing store during miss handling is usually copied into the cache, ready for the next access.
During a cache miss, the CPU usually ejects some other entry in order to make room for the previously uncached datum. The heuristic used to select the entry to eject is known as the replacement policy. One popular replacement policy, "least recently used" (LRU), replaces the least recently used entry (see cache algorithms). More efficient caches compute use frequency against the size of the stored contents, as well as the latencies and throughputs for both the cache and the backing store. This works well for larger amounts of data, longer latencies and slower throughputs, such as experienced with a hard drive and the Internet, but is not efficient for use with a CPU cache.

funny pictures




Theme © iAndrew 2016 - Forum software by © MyBB