0
Count distinct records or values and display it using mysql and php
This tutorial shows you how to count unique records with mysql and display it using php. Very simple to understand.
This line
count(<COLUMN_NAME>) AS count_me
simply means that the count value is assigned to variable count_me and we...
Sort MYSQL data according to the date in php or mysql itself
Sort the data from mysql using date.
If you have a field inside mysql for DATE and you need to sort the data accordingly in ascending or descending order you can use this UNIX_TIMESTAMP(FIELD NAME).
You can even update your existing SQL TYPE...
Set xampp:- Apache Mysql Filezilla Mercury Tomcat as a windows service and get xampp to start automatically on boot up
Set xampp- Apache,Mysql, Filezilla, Mercury and Tomcat as a windows service and get xampp to start automatically on boot up.
For this first we need to install xampp on windows. Refer this LINK ON HOW TO INSTALL XAMPP or we have a set of tutorials...
Redirect webpage using php
Redirect webpage after a specific time delay using php.We have html code for redirecting one webpage to another.But here we have php for doing the same. We can even give a delay of our choice inside the code. Grab the code here.
< ?php header("refresh:3;url=redirected.htm");?>
Put...
Read text file reverse using php
Read text file reverse using php
$file = file('text.txt');
$read_rev = array_reverse($file);
$count=0;
foreach ($read_rev as $dis_line) {
print_r($dis_line);
echo "<br />";
}
Demo
VN:F [1.9.13_1145]please wait...Rating: 2.0/10...
Send mail to admin or website owner when ever the logs show 404 or 500 or 401 or 400 error codes
Send an mail to admin or website owner when ever the logs show 404 or file not found error.This script can be used as a cron and is run on everyday basis to get all the details in your email.You can modify the code URI accordingly to get different...
Date in title bar using php
This is a simple script that appends date inside the html title tag.
<title>Today is < ?php print date("l"); print(", "); print date("d/M/y");?></title>
VN:F [1.9.13_1145]please wait...Rating:...
Output buffering using ob_start in php
Output buffering using ob_start in php and saving it to a variable, this is a very good feature available in php mainly when we want to output and html data or php data
ob_start(); //Turn on output buffering ?>
Get this link <a href="http://www.mistonline.in">output...
Get browser language using php
In php you can get the language of your visitor, this is very helpful if you have many versions of your website for different languages.
$language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
echo "The browser language is ".$language;
VN:F...
Find files inside a directory that starts with a specific string using php
Find files inside a directory that starts with a specific string using php.This script will search for files that starts with a string [Whatever you give] inside the query string.
For instance if the below script is saved inside a file say search_files.php...
Find the string and then the line number using php from text file
Find the string and then the line number using php from text file or a text data base.
In this we are searching a string named alan inside one of our log files.
$searchString = 'alan';
$URL = "logs/logs.txt_2011-08-10";
$data = file_get_contents($URL);
$data...
Display text file line by line and delete certain lines using php
Display text file or text data base line by line and delete certain lines using php. Each line of the text file is read and a DELETE link is added along with it.Grab the script here. NOTE:-My text file name is mail_list.txt
Create a file with...
View edit and save text file database using php
This tutorial will help you in viewing editing and saving a text file database using si php.
//your file name here
$fn = "My_File.txt";
if (isset($_POST['content']))
{
$content = stripslashes($_POST['content']);
$fp = fopen($fn,"w")...
