Monthly Archives: March 2016

ajaxFunction

ajaxFunction(val,ajaxDiv,urlAjax)

val = nilai yang hendak dihantar.
ajaxDiv = id div di mana data ajax mahu dipaparkan.
urlAjax = path fail yang memproses

Cth :-

onclick=”ajaxFunction(this.value,’divFac‘,’ajax/ajax.fac.php‘)”

di fail ajax.fac.php

$entity = $_GET[‘val’];  // val akan terima value yang dihantar.
$sqlfac = “SELECT DISTINCT a.fac_code, a.fac_name ”
. “FROM ta_faculty a ”
. “INNER JOIN ta_courselist_bank b ON a.fac_code = b.fac_code ”
. “WHERE b.entity=’$entity’ AND a.fac_sts=’A’ “

Droplist lebih 1 field display

$entity = $_GET[‘entity’];
$fac = $_GET[‘val’];

$sqlcourse = “SELECT DISTINCT course_code,course_code || ‘ – ‘ || course_name_bi || ‘ (‘ || course_name_bm || ‘)’ AS course_name
FROM ta_courselist_bank
WHERE entity=’$entity’ AND fac_code=’$fac’
ORDER BY course_name”;

Db::droplist($sqlcourse, ‘course_code’, ‘course_code’, ‘course_name’, @$course_code, ‘lebar paddl050′,’:: Choose Course’);

Tambah tahun, bulan, hari dalam tarikh

Tambah 5 tahun : select now() + INTERVAL ‘5’ year;

Tambah 5 bulan : select now() + INTERVAL ‘5’ month;

Tambah 5 hari : select now() + INTERVAL ‘5’ day;

Tambah tahun, bulan & hari : select now() + INTERVAL ‘5’ year + INTERVAL ‘5’ month + INTERVAL ‘5’ day;