Rabu, 15 April 2009

Dropdown Data from Table ( PHP script)

()

Sintax :

select.....
php quote

if ($edit==1)
{
$perintah="SELECT * from tm_jabatan where kd_jabatan='$kd_jabatan';
$hasil=mysql_query($perintah);
while ($row=mysql_fetch_array($hasil))
{
$kd_jabatan=$row["kd_jabatan"];
$nm_jabatan=$row["nm_jabatan"];
echo("");
}
}

$perintah="SELECT * from tm_jabatan where stat_jab='1' order by kd_jabatan";
$hasil=mysql_query($perintah);
while ($row=mysql_fetch_array($hasil))
{
$kd_jabatan=$row["kd_jabatan"];
$nm_jabatan=$row["nm_jabatan"];
echo("");
}

php quote

end select

Senin, 13 April 2009

Dropdown Listbox ( PHP script)

pembuka select .......
// // if ($editx==1)
// switch ($kd_hid_level)
// {
// case "0" :echo('Kantor Pusat / Kantor Wilayah');break;
// case "1" :echo('Divisi / Kantor Cabang');break;
// case "2" :echo('UPC');break;
// }
// echo("");
// }
// echo("UPC");
// ?>
penutup /select..

Senin, 06 April 2009

number of row ( PHP Script)

$perintah2="SELECT * FROM .........";
$hasil2=mysql_query($perintah2) or die('Tidak ada data');
$n_data=mysql_num_rows($hasil2);
if ($n_data==0)
{
.......................;
}

Select Date Now from MySQL

$perintah="select DATE_FORMAT(now(),'%Y-%m-%d') as tgl_periode";
$hasil=mysql_query($perintah) or die($perintah);
while ($row=mysql_fetch_array($hasil))
{
$tgl_periode=$row["tgl_periode"];
}