Macam mana nak kira Umur dari DOB using PHP

11:34 / Comments (0) / by SeLaMbeR

Masalah :

Ali tgh develope satu sistem yang memerlukan pengiraan umur. Igatkan masalah dah solve bila ali jupe satu kding tuh, mmg dia leh kira umur. tp kira umur dr tahun lahir jer. So sekarang nih bos ali nak suruh ali cari plak pengiraan yang exactly boleh kira hari dan bulan lahir. Cth : katalah ali lahir 1/12/1980..
kalau kira by tahun umur ALi hari ni (2/11/2009)ialah 29 tahun,
tapi bos ali x nak mcm tuh dia nak umur tuh tepat cam umur Alli hari ini ialah 28 tahun 11 bulan 1 hari.



MySQL LEFT, RIGHT JOIN

16:10 / Comments (0) / by SeLaMbeR

MySQL joins are hard for beginners. At least for me when I was beginner.I will try to explain the joins in the simplest possible way.

Join in MySQL is a query where you can join one or more tables.

For example we have two tables: products and buyers with the following structures.




PHP - Explode

15:52 / Comments (0) / by SeLaMbeR


The regular expression parameters such as \n or \t can be used as well as other strings as the delimeter which can be used to parse any given text files or downloaded web pages to read line by line.

An example may be considered as, name surname and phone numbers are written into a text file line by line and columns are seperated by tabs, can be exploded and read easily through the return and tab characters. After storing them in the array they can be manipulated or displayed in any other formats.



Font Resizing using JavaScript

09:51 / Comments (0) / by SeLaMbeR

Font Resizing is a very common feature in many modern websites. This can be done very easily with jQuery. The following script uses cookies to save the user preference, so the user preference is saved. jQuery Cookie plugin is used for managing cookie using jQuery. So include that too.
the html for increase, decrease links



Kira perkataan di dalam string - PHP

22:44 / Comments (0) / by SeLaMbeR

Counts the number of words inside string. If the optional format is not specified, then the return value will be an integer representing the number of words found. In the event the format is specified, the return value will be an array, content of which is dependent on the format. The possible value for the format and the resultant outputs are listed below.

For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with "'" and "-" characters.



Manipulasi bagi JavaScript Allert box

21:05 / Comments (0) / by SeLaMbeR


Kali ini kita cuba pula manipulasi penggunaan JavaScript alert, di syorkan sebab JavaScript ni lagi mudah dan senang penggunaannya cuma cantik je seperti ajax atau jQuery. Di sini di paparkan beberapa contoh alert.







PHP - Panggil data daripada database.

22:04 / Comments (0) / by SeLaMbeR


Di sini kita akan membuat 1 simple php di mana kita paggil data yang kita mahukan dari database.
Sila lihat contoh di bawah:

Nama database : database
Nama table : kelas
Paparan yang kita mahukan : nama_pelajar




Cara menutup page anda dengan javascript

16:27 / Comments (0) / by SeLaMbeR

Apabila pengguna menetak butang "Tutup aque-selamber?" fungsi pengesahan akan berjalan. JavaScript kemudian membuat tetingkap popup dengan dua pilihan dan akan mengembalikan nilai untuk kod script kita bergantung pada butang klik pengguna.

Jika pengguna mengklik OK, nilai 1 dikembalikan. Jika pengguna mengklik cancel, nilai 0 dikembalikan.



PHP - simple calculator

11:01 / Comments (0) / by SeLaMbeR

Buat 1 funtion :

<?php
// Defining the "calc" class
class calc {
var $number1;
var $number2;
function add($number1,$number2)
{
$result =$number1 + $number2;
echo "The sum of $number1 and $number2 is $result<br><br>";
echo "$number1 + $number2 = $result";
exit;
}
function subtract($number1,$number2)
{
$result =$number1 - $number2;
echo "The difference of $number1 and $number2 is $result<br><br>";
echo "$number1 &#045 $number2 = $result";
exit;
}
function divide($number1,$number2)
{
$result =$number1 / $number2;
echo "$number1 divided by $number2 is $result<br><br>";
echo "$number1 ? $number2 = $result";
exit;
}
function multiply($number1,$number2)
{
$result =$number1 * $number2;
echo "The product of $number1 and $number2 is $result<br><br>";
echo "$number1 x $number2 = $result";
exit;
}
function square($number)
{
$result = $number * $number;
echo "The square of $number is $result<br><br>";
echo "$number &#94; 2 = $result";
}
function squareroot($number)
{
$result = sqrt($number);
echo "The square root of $number is $result<br><br>";
}
function cube($number)
{
$result = $number * $number * $number;
echo "The cube of $number is $result<br><br>";
echo "$number1 &#94; 3 = $result";
}
}
//Creating object of class
$calc = new calc();
?>


 
Share