|
salam..
nk mntk tlg sape2 yg boleh tgk kn code ni, ape error die..ni juz part of the coding utk save then go the next page automatically...ade error kt coding header: location tu...tlg ek..
$layak="Layak";
$tidakLayak= "Tidak Layak";
$noSijilLahir=$_POST['noSijilLahir'];
$pekerjaan=$_POST['pekerjaan'];
$gaji=$_POST['gaji'];
$tanggungan=$_POST['tanggungan'];
$link=mysql_connect("localhost","root","" )or die ("could not connect" ) ;
$db=mysql_select_db("prasekolah",$link)or die ("could not select database" ) ;
if ($pekerjaan=="swasta" )
{
//jika gaji dibawah RM799
if ($gaji=="bawah" )
{
if ($tanggungan=="tiga" )
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' " ) ;
$result=mysql_query($sql) ;
if ($result)
{
header( "Location:keputusan.php" ) ;
}
else {
echo "ERROR";
}
}
if($tanggungan=="empat" )
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' " ) ;
$result=mysql_query($sql) ;
if ($result)
{
header( "Location:keputusan.php" ) ;
}
else {
echo "ERROR";
}
}
if($tanggungan=="tujuh" )
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' " ) ;
$result=mysql_query($sql) ;
if ($result)
{
header( "Location:keputusan.php" ) ;
}
else {
echo "ERROR";
}
}
}
}
?> |
|
|
|
|
|
|
|
cuba paste error tu kat sini..
[ Last edited by EAStudent at 1-5-2009 17:06 ] |
|
|
|
|
|
|
|
ape error nye? |
|
|
|
|
|
|
|
ni error nye..
"Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\prasekolah\layak.php:2) in C:\xampp\htdocs\prasekolah\layak.php on line 32"
yg error tu kt bhgian header nk call location..
[ Last edited by purpyani at 1-5-2009 18:04 ] |
|
|
|
|
|
|
|
Reply #4 purpyani's post
Based on error message ko ni...kalo x silap aku...error ni jadi kalo ko nk call header tapi page ko tu da ada echo something or ada apa2 output lain sebelum ko call directive header tu...coding ko ni complete atau ada lagi yang atas2 nye ?? |
|
|
|
|
|
|
|
yg atas2 nye tu dh xde dh
stat ngan <?php then trus code ni
$layak="Layak";
$tidakLayak= "Tidak Layak";
and seterus nye..
bwh2 tu ade lg if else, tp bnde yg same je..just if tuk bnde lain lak
ble aku buang query tu, header tu boleh d call tp ble buh blk, header tu xleh call,
query tu bleh jalan, bnde yg nk d update tu dh d update kt db, tp " if(result) " die x leh nk run, die run bhgian " else{ echo"erro"}; "
ape ek silap die?? |
|
|
|
|
|
|
|
<?php then trus code ni
$layak="Layak";
$tidakLayak= "Tidak Layak";
cuba kau buang space antara <?php ngan code
jadi macam ni..
<?php
$layak="Layak";
$tidakLayak= "Tidak Layak";
pastikan coding ni atas sekali..
atas dari html sumer.. |
|
|
|
|
|
|
|
Reply #7 EAStudent's post
em..xleh gk....
ade effect ke kalo jarak kn
<?php
ngan coding?
html code mmg xde dlm page ni, page ni ju tuk process then keputusan nye die akan kuar kt yg aku call kt header tu la..
coding aku tu ade salah mne2 ke?query tu betul ke??
sbb rasenye cm xde silap dh..
tp xtaula kan..mntk tlg sgt2
[ Last edited by purpyani at 1-5-2009 22:10 ] |
|
|
|
|
|
|
|
Reply #8 purpyani's post
Patut nye x de effect whitespace tu...menda ni jadi sbb ada statement dlm if structure ko yg ko assume x mungkin execute tp sbenarnye bila PHP Processor ko run condition tu meet & ko nye echo "ERROR"; tu ada kuarkn output...
Kalo nk trace 1-1...kena la buang dulu header tu...echo tiap2 if branch ko...kalo ko nk shortcut...ko ganti je echo "ERROR"; tu dgn header("Location:error.php");
*p/s: tuan rumah x biasa lg buat programming ek ?? coding ko ni patut bley simplify lg...skrg ni x brapa economical ar... |
|
|
|
|
|
|
|
Reply #9 digitalgunner's post
ok..thanks..
dh try tukar, tp ble dh run, die kuar error msg yg sme cm header awl td
"Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\prasekolah\result.php:20)..."
xbiase?em..sbnrnye biase dh,tp ble time degree ni, u ni cm kurg dedah kn bdk2 ngan programming secara praktikal..lbh pda teori je..time dip dlu mmg stiap sem, projek wt sistem..ble dh lme x buat, tu yg cm confius sket..lgpn php ni sy try..biase time dip dlu slalu wt stand alone sistem je, gne vb ke access ke c++ ke..php ni bru sgt2.. |
|
|
|
|
|
|
|
Reply #10 purpyani's post
Tak boleh gak ek...paste la sume skali coding tu kt sini...yang bawah2 nye if condition skali...baru bley nk trace...tp nk tanye yg input utk tanggungan tu mmg guna string value ke ?? |
|
|
|
|
|
|
|
ni utk update:
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' " ) ;
$result=mysql_query($sql) ; <-- ni utk apa?? true false??
[ Last edited by budingyun at 2-5-2009 23:24 ] |
|
|
|
|
|
|
|
aku rasa cmni :
<?
$layak="Layak";
$tidakLayak= "Tidak Layak";
$noSijilLahir=$_POST['noSijilLahir'];
$pekerjaan=$_POST['pekerjaan'];
$gaji=$_POST['gaji'];
$tanggungan=$_POST['tanggungan'];
$link=mysql_connect("localhost","root","" )or die ("could not connect" ) ;
$db=mysql_select_db("prasekolah",$link)or die ("could not select database" ) ;
if ($pekerjaan=="swasta" )
{
//jika gaji dibawah RM799
if ($gaji=="bawah" )
{
if ($tanggungan=="tiga" )
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' " ) ;
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" ) ;
exit;
}
else
{
echo "ERROR";
}
}
elseif($tanggungan=="empat" )
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' " ) ;
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" ) ;
exit;
}
else
{
echo "ERROR";
}
}
elseif($tanggungan=="tujuh" )
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' " ) ;
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" ) ;
exit;
}
else
{
echo "ERROR";
}
}
}
}
?>
cuba try..
[ Last edited by budingyun at 2-5-2009 23:01 ] |
|
|
|
|
|
|
|
header ko location yg sama kan..wat satu cukup la...
dan ko punya if tu kan syarat jer lain dlm sumer sama..apa motifnya??
patut syarat lain2 sbb dalam lain2 kan..
[ Last edited by budingyun at 2-5-2009 23:19 ] |
|
|
|
|
|
|
|
ni aku cuba ringkaskan :
<?
$layak="Layak";
$tidakLayak= "Tidak Layak";
$noSijilLahir=$_POST['noSijilLahir'];
$pekerjaan=$_POST['pekerjaan'];
$gaji=$_POST['gaji'];
$tanggungan=$_POST['tanggungan'];
$link=mysql_connect("localhost","root","" )or die ("could not connect" ) ;
$db=mysql_select_db("prasekolah",$link)or die ("could not select database" ) ;
if ($pekerjaan=="swasta" )
{
//jika gaji dibawah RM799
if ($gaji=="bawah" )
{
if (($tanggungan=="tiga") || ($tanggungan=="empat" ) || ($tanggungan=="tujuh" ))
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' " ) ;
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" ) ;
exit;
}
else
{
echo "ERROR";
}
}
}
}
?>
[ Last edited by budingyun at 2-5-2009 23:25 ] |
|
|
|
|
|
|
|
Reply #11 digitalgunner's post
ok..ni coding yg asal n input tanggungan mmg string..
<?php
$layak="Layak";
$tidakLayak= "Tidak Layak";
$noSijilLahir=$_POST['noSijilLahir'];
$pekerjaan=$_POST['pekerjaan'];
$gaji=$_POST['gaji'];
$tanggungan=$_POST['tanggungan'];
$link=mysql_connect("localhost","root","")or die ("could not connect");
$db=mysql_select_db("prasekolah",$link)or die ("could not select database");
if ($pekerjaan=="swasta")
{
//jika gaji dibawah RM799
if ($gaji=="bawah")
{
if (($tanggungan=="tiga") || ($tanggungan=="empat") || ($tanggungan=="tujuh"))
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
//jika gaji RM800 hingga RM1499
if ($gaji=="tengah")
{
if ($tanggungan=="tiga" || $tanggungan=="empat")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$tidakLayak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan_tidaklayak.php" );
}
else {
echo "ERROR";
}
}
if ($tanggungan=="tujuh")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
//jika pendapatan bersih lebih dari RM1500
if ($gaji=="lebih")
{
if ($tanggungan=="tiga" || $tanggungan=="empat")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$tidakLayak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan_tidaklayak.php" );
}
else {
echo "ERROR";
}
}
if($tanggungan=="tujuh")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
}
|
|
|
|
|
|
|
|
Reply #11 digitalgunner's post
ni sambungan code tu
//jika pekerja kerajaan
if ($pekerjaan=="kerajaan")
{
//jika gaji dibawah RM799
if ($gaji=="bawah")
{
if ($tanggungan=="tiga")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$tidakLayak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan_tidaklayak.php" );
}
else {
echo "ERROR";
}
}
if($tanggungan=="empat" || $tanggungan=="tujuh")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
//jika gaji RM800 hingga RM1499
if ($gaji=="tengah")
{
if ($tanggungan=="tiga" || $tanggungan=="empat")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='Tidak Layak' where noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{ header( "Location:keputusan_tidaklayak.php" ); }
else {
echo "ERROR";
}
}if($tanggungan=="tujuh")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
//jika pendapatan bersih lebih dari RM1500
if ($gaji=="lebih")
{
if ($tanggungan=="tiga" || $tanggungan=="empat")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$tidakLayak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan_tidaklayak.php" );
}
else {
echo "ERROR";
}
}if ($tanggungan=="tujuh")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
}
|
|
|
|
|
|
|
|
Reply #11 digitalgunner's post
ni smbungan die lg...last..sory, pnjg sket code nye..tu yg kne wt smpai 3 kali post..
//jika bekerja sendiri
if ($pekerjaan=="kampung")
{
//jika gaji dibawah RM799
if ($gaji=="bawah")
{
if ($tanggungan=="tiga")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$tidakLayak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan_tidaklayak.php" );
}
else {
echo "ERROR";
}
}if($tanggungan=="empat" || $tanggungan=="tujuh")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
//jika gaji RM800 hingga RM1499
if ($gaji=="tengah")
{
if ($tanggungan=="tiga")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$tidakLayak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan_tidaklayak.php" );
}
else {
echo "ERROR";
}
}if($tanggungan=="empat" || $tanggungan=="tujuh")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
//jika pendapatan bersih lebih dari RM1500
if ($gaji=="lebih")
{
if ($tanggungan=="tiga" || $tanggungan=="empat")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$tidakLayak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan_tidaklayak.php" );
}
else {
echo "ERROR";
}
}if ($tanggungan=="tujuh")
{
$sql=mysql_query("UPDATE kelayakan SET statusKelayakan='$layak' WHERE noSijilLahir='$noSijilLahir' ");
$result=mysql_query($sql);
if ($result)
{
header( "Location:keputusan.php" );
}
else {
echo "ERROR";
}
}
}
}
?> |
|
|
|
|
|
|
|
Reply #15 budingyun's post
dh try gk..tp stil x dpt..die trus bace kt echo error tu |
|
|
|
|
|
|
|
Balas #19 purpyani\ catat
if ($result) <-- ni utk apa sbnrnya??
rasanya syarat ni cam xbetul/? |
|
|
|
|
|
|
| |
|