Filed Under (Others) by admin on 23-01-2012
To display the executed query using the codeigniter database class
insert the line of code below
echo $this->db->last_query();
$this->db->last_query(); //returns the last executed query
————————————————————————————————-
So if your code is like this
$this->db->select('*');
$this->db->from('sales');
$query = $this->db->get();
echo $this->db->last_query();
// Adding echo $this->db->last_query(); will output the query on the page like this
// SELECT * FROM sales;
Filed Under (linux) by admin on 18-01-2012
Here we will use the find -mtime and xargs commands
Complete script:
find '/home/user/data/' -name '*.txt' -mtime +7 | xargs rm
Explanation:
find -mtime displays files made based on given number of days
find '/home/user/data/' -name '*.txt' -mtime +7
xargs captures the result of a previous command and pass it as an argument for another function
find '/home/user/data/' -name '*.txt' -mtime +7 | xargs rm
The result of the find command is passed to another function rm which then removes the files
Filed Under (Others) by admin on 18-01-2012
mysqldump -u username -p Password database_name | gzip > database_backup.sql.gz