| |
Forum PHP IndonesiaDapatkan pertolongan pertama pada kebingungan PHP dan sekitarnya |
|
|
|
|
|
| |
|
|
All times are GMT + 7 Hours
|
|
tanya insert session ke database
 |
Mon Jul 19, 2010 10:52 |
 |
Author |
Message |
pephy PHP Programmer

Joined: 11 Jun 2010 Posts: 59 Location: indonesia
|
| Post subject: tanya insert session ke database |
|
|
para master2 php . bs bntuin saya gag??
masukin nilai total yg pake session k database mysql???
tlg bntuannya ..
thx a lot _________________ Berbagi iL mu itu Indah .... |
|
| |
|
|
 |
Mon Jul 19, 2010 13:49 |
 |
Author |
Message |
atkinson PHP Master


Joined: 28 Feb 2010 Posts: 255 Location: /home/night
|
| Post subject: |
|
|
total gimana mas?
perasaan masukin biasa aja...
misal mau masukin $_SESSION[total] ya tinggal
mysql_query("insert into tabel values('$_SESSION[total]'"); _________________ samarinda web developer http://onewebstudio.com |
|
| |
|
|
 |
Mon Jul 19, 2010 16:13 |
 |
Author |
Message |
pephy PHP Programmer

Joined: 11 Jun 2010 Posts: 59 Location: indonesia
|
| Post subject: |
|
|
mksd saya semua nilai yg ada pada file2 . kn sya buat 3 file. mudah.php,sedang,phpdan sulit php. trz nilai total di hasil.php .
kn sya pke session bwd ngkap total nilai dr file2 tsb.
smwanya uda bsa . tinggl msukin total nilai dr file hasil.php tsb k database mysql .
jd gny .
nii scriptnya : hasil.php
| Code: | <?php <?php session_start(); ?>
<?php
$benar1 = $_SESSION["mudah"]["nbenar"];
$salah1 = $_SESSION["mudah"]["nsalah"];
$nilai1 = number_format($_SESSION["mudah"]["ntotal"],1);
$persen1 = $_SESSION["mudah"]["persen"];
$kategori1 = $_SESSION["mudah"]["kategori"];
$jumlah1 = $nilai1*$persen1;
echo('<br /> <br />');
echo '<B>REKAP NILAI KATEGORI MUDAH : </B>' ; echo ' '; echo ' <font color="blue"><I>( BOBOT NILAI KATEGORI MUDAH 20 % )</I></font>';
echo('<br />');
echo ' '; echo 'NILAI BENAR : '; echo ($benar1); echo ' '; echo 'soal'; echo('<br />');
echo ' '; echo 'NILAI SALAH : '; echo ($salah1); echo ' '; echo 'soal'; echo('<br />');
echo ' '; echo 'NILAI TOTAL : '; echo ($nilai1);
echo('<br />');
echo '<B>Persentase : </B> ';
echo ($jumlah1);echo '%'; echo ' ';
echo ' Termasuk : '; echo ($kategori1); echo('<br />');
$benar2 = $_SESSION["sedang"]["nbenar"];
$salah2 = $_SESSION["sedang"]["nsalah"];
$nilai2 = number_format($_SESSION["sedang"]["ntotal"],1);
$persen2 = $_SESSION["sedang"]["persen"];
$kategori2 = $_SESSION["sedang"]["kategori"];
$jumlah2 = $nilai2*$persen2;
echo('<br /> <br />' );
echo '<B>REKAP NILAI KATEGORI SEDANG : </B>' ; echo ' '; echo ' <font color="blue"><I>( BOBOT NILAI KATEGORI SEDANG 30 % )</I></font>';
echo('<br />');
echo ' '; echo 'NILAI BENAR : '; echo ($benar2); echo ' '; echo 'soal'; echo('<br />');
echo ' '; echo 'NILAI SALAH : '; echo ($salah2); echo ' '; echo 'soal'; echo('<br />');
echo ' '; echo 'NILAI TOTAL : '; echo ($nilai2);
echo('<br />');
echo '<B>Persentase : </B> ';
echo ($jumlah2);echo '%'; echo ' ';
echo ' Termasuk : '; echo ($kategori2); echo('<br />');
$benar3 = $_SESSION["sulit"]["nbenar"];
$salah3 = $_SESSION["sulit"]["nsalah"];
$nilai3 = number_format($_SESSION["sulit"]["ntotal"],1);
$persen3 = $_SESSION["sulit"]["persen"];
$kategori3 = $_SESSION["sulit"]["kategori"];
$jumlah3 = $nilai3*$persen3;
echo('<br /> <br />');
echo '<B>REKAP NILAI KATEGORI SULIT : </B>' ; echo ' '; echo ' <font color="blue"><I>( BOBOT NILAI KATEGORI SULIT 50 % )</I></font>';
echo('<br />');
echo ' '; echo 'NILAI BENAR : '; echo ($benar3); echo ' '; echo 'soal'; echo('<br />');
echo ' '; echo 'NILAI SALAH : '; echo ($salah3); echo ' '; echo 'soal'; echo('<br />');
echo ' '; echo 'NILAI TOTAL : '; echo ($nilai3);
echo('<br />');
echo '<B>Persentase : </B> ';
echo ($jumlah3);echo '%'; echo ' ';
echo ' Termasuk : '; echo ($kategori3); echo ('<br />');
echo('<br /> <br />');
$benartotal=$benar1+$benar2+$benar3;
$nilaitotal=$nilai1+$nilai2+$nilai3;
$jumlahtotal=$jumlah1+$jumlah2+$jumlah3;
if($benartotal==0)
{
if($nilaitotal==0)
$g = '<U><b><font color="red">GAGAL</font></B></U>';
}
if($benartotal>0)
{
if($nilaitotal>=290)
$g = '<b><U><i>PASTI LULUS</i></u></b>';
elseif($nilaitotal>=250 && $nilaitotal<290)
$g = '<b><u><i>LULUS</i></u></b>';
elseif($nilaitotal>=200 && $nilaitotal<250)
$g = '<b><u><i>LULUS</i></u></b>';
elseif($nilaitotal>=150 && $nilaitotal<200)
$g = '<FONT COLOR="red"><b><U><i>GAGAL</i></u></b></FONT>';
else
$g = '<FONT COLOR="red"><b><u><i>GAGAL</i></u></b></FONT>';
}
?> ?> |
kn $nilaitotal dan $g mau sya msukin k database ...
krn $nilaitotal adalah nilai totalnya ..
dn $g adaalah kategorinya ....
jd sya msukin kdatabase gt..
enaknya di tmbhin script query gmn???
mhon bntuannya..
trims... _________________ Berbagi iL mu itu Indah .... |
|
| |
|
|
 |
Mon Jul 19, 2010 17:20 |
 |
Author |
Message |
atkinson PHP Master


Joined: 28 Feb 2010 Posts: 255 Location: /home/night
|
| Post subject: |
|
|
haduh haduh.. hehe.. tiba2 saya pusing liat sciprt...
ana nyerah duluan... heheh
lgi pula ana msih bingung,, belum jelas,, soalnya itu semua kan uda ada,, uda ada $nilaitotal uda ada $g
ya tinggal masukin aja...
mysql_query("insert into tabel values ('$nilaitotal','$g')");
tunggu temen2 yg lain deh..
master2 bantuin donk  _________________ samarinda web developer http://onewebstudio.com |
|
| |
|
|
 |
Fri Jul 30, 2010 03:29 |
 |
Author |
Message |
pephy PHP Programmer

Joined: 11 Jun 2010 Posts: 59 Location: indonesia
|
| Post subject: |
|
|
oke thx bro .
berhasil trnyta .
thx a lot .
(' ')
(' ') _________________ Berbagi iL mu itu Indah .... |
|
| |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
|
|
|
Powered by phpBB © 2001, 2002 phpBB Group
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|