CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

Author: bender

tumpang tanye psl html n php

[Copy link]
Post time 10-3-2009 10:17 AM | Show all posts
apa yg ko dpt??? script?
Reply

Use magic Report


ADVERTISEMENT


Post time 10-3-2009 10:35 AM | Show all posts
dapat ape?...yg markah n gred tu kan yg coding board bg tu...aku try edit nak buat mcm table kat atas tu...xjd...
Reply

Use magic Report

Post time 11-3-2009 10:27 PM | Show all posts
cane board...mmc mane nak buat yg table mcm yg aku post tu?
Reply

Use magic Report

Post time 12-3-2009 12:12 AM | Show all posts
nama student tu nk letak kat mana n???
Reply

Use magic Report

Post time 12-3-2009 12:19 AM | Show all posts
nama student letak kat sebelah subjek...
Reply

Use magic Report

Post time 12-3-2009 01:34 AM | Show all posts
n list kan semua nama.. tak berapa cantik
  1. $conn    = mysql_connect($host, $user, $passwd) or die(mysql_error());
  2. $link    = mysql_select_db($db, $conn) or die(mysql_error());
  3. $pass_mark = 50;

  4. function grade($mark){
  5.     global $pass_mark;
  6.     if(is_numeric($mark)){
  7.         switch($mark):
  8.         case $mark>=90:
  9.         $grade='A';
  10.         break;
  11.         case $mark>=80&&$mark<90:
  12.         $grade='B';
  13.         break;
  14.         case $mark>=70&&$mark<80:
  15.         $grade='C';
  16.         break;
  17.         case $mark>=60&&$mark<70:
  18.         $grade='D';
  19.         break;
  20.         case $mark>=50&&$mark<60:
  21.         $grade='E';
  22.         break;
  23.         case $mark<$pass_mark:
  24.         $grade='F';
  25.         break;
  26.     endswitch;
  27.     return $grade;
  28.     }
  29. }

  30. $sql = "SELECT * FROM student ORDER BY name";
  31. $query = mysql_query($sql);
  32. ?>
  33. <table border="1">
  34.   <tr>
  35.     <td>Name</td>
  36.     <td>Subject</td>
  37.     <td>Mark</td>
  38.     <td>Gred</td>
  39.   </tr>
  40.   <? while($row=mysql_fetch_assoc($query)){ ?>
  41.   <tr>
  42.     <td><?= $row['name'] ?></td>
  43.     <td><?= $row['subject'] ?></td>
  44.     <td><?= $row['mark'] ?></td>
  45.     <td<?= grade($row['mark'])=='F'?' style="color:#FF0000"':''?>><?= grade($row['mark']) ?></td>
  46.   </tr>
  47.   <? } ?>
  48. </table>
Copy the Code
Reply

Use magic Report

Follow Us
Post time 12-3-2009 01:41 AM | Show all posts
n pulak group by name
  1. $conn    = mysql_connect($host, $user, $passwd) or die(mysql_error());
  2. $link    = mysql_select_db($db, $conn) or die(mysql_error());
  3. $pass_mark = 50;

  4. function grade($mark){
  5.     global $pass_mark;
  6.     if(is_numeric($mark)){
  7.         switch($mark):
  8.         case $mark>=90:
  9.         $grade='A';
  10.         break;
  11.         case $mark>=80&&$mark<90:
  12.         $grade='B';
  13.         break;
  14.         case $mark>=70&&$mark<80:
  15.         $grade='C';
  16.         break;
  17.         case $mark>=60&&$mark<70:
  18.         $grade='D';
  19.         break;
  20.         case $mark>=50&&$mark<60:
  21.         $grade='E';
  22.         break;
  23.         case $mark<$pass_mark:
  24.         $grade='F';
  25.         break;
  26.     endswitch;
  27.     return $grade;
  28.     }
  29. }

  30. $sql = "SELECT name FROM student GROUP BY name";
  31. $query = mysql_query($sql);
  32. ?>
  33. <table border="1">
  34.   <tr>
  35.     <td>Name</td>
  36.     <td>Subject</td>
  37.     <td>Mark</td>
  38.     <td>Gred</td>
  39.   </tr>
  40.   <? while($row=mysql_fetch_assoc($query)){ ?>
  41.   <tr>
  42.     <td colspan="4"><?= $row['name'] ?></td>
  43.   </tr>
  44.   <?
  45.       $sql2 = "SELECT * FROM student WHERE name = '".$row['name']."' ORDER BY subject";
  46.     $query2 = mysql_query($sql2);
  47.     while($row2=mysql_fetch_assoc($query2)){
  48.   ?>
  49.   <tr>
  50.     <td> </td>
  51.     <td><?= $row2['subject'] ?></td>
  52.     <td><?= $row2['mark'] ?></td>
  53.     <td<?= grade($row2['mark'])=='F'?' style="color:#FF0000"':''?>><?= grade($row2['mark']) ?></td>
  54.   </tr>
  55.   <? }} ?>
  56. </table>
Copy the Code
Reply

Use magic Report

Post time 13-3-2009 05:52 AM | Show all posts
thanks board...
Reply

Use magic Report


ADVERTISEMENT


Post time 13-3-2009 12:09 PM | Show all posts
Board

Camna yang orang buat kalau nak pilih tarikh keluar calendar kecik then user boleh main click-click kat kalendar tu, terus jadi value field tu?

Aku nak buat ler.. hehe.. nampak pro
Reply

Use magic Report

Post time 18-3-2009 02:47 AM | Show all posts
board.....cane ek nak buat...based on pic bawah nie,...



dlm table temujanji aku tu ader status............so kalo kite terima..status dier akan tulis "Temujanji anda telah diterima"...
pastu kalo tolak..."Temujanji anda telah ditolak.."...

so aku nak create 1 lagi entiti iaitu status2..........status2 ni dier akan simpan nilai 1 kalo terima n nilai 0 kalo tolak...

sebabnya nanti aku nak display temujanji yg diterima je.... so cane ek kalo kite terima pastu dier simpan dlm status2 tu 1..........

ke board ade cara lain?

aku try letak&#160;"Temujanji anda telah ditolak.." as value dlm textfield...n name sbg status

pastu bile panggil aku wat gini

$status =&_POST['status'];

$sql="SELECT * FROM temujanji WHERE status = '$status' order by bil DESC";


tp dier xkuar gak....


lepas tu aku try la create dlm db tu aku letakla status2 tu nilai 1..........yg ni aku insert sindri dlm db...n then aku try panggil
$sql="SELECT * FROM temujanji WHERE status2 = 1 order by bil DESC";
dier jadik....so aku plan nak bwat mcm nie la....tp yg masalahnye cane aku nak masukkan nilai status2 tu adalah 1 bile aku Terima n nilai 0 bila aku Tolak.....

[ Last edited by  pzan213 at 18-3-2009 02:48 ]
Reply

Use magic Report

Post time 19-3-2009 03:04 PM | Show all posts
board xde keee
Reply

Use magic Report

Post time 20-3-2009 01:16 AM | Show all posts
tak berapa nak faham soalan........
dah 4x baca.....
Reply

Use magic Report

Post time 20-3-2009 03:25 AM | Show all posts
ye ke xpaham..huhuhu...mcm nie...

dlm table temujanji tu kirenye ader 2 entiti.... status dan status2......kirenya status tu akan pegang nilai "temujanji diterima" dan status2 akan pegang nilai 1 bila pilih TERIMA dan HANTAR

n status tu akan pegang nilai "Temujanji Ditolak" dan status2 akan pegang nilai 0 bila pilih TOLAK n HANTAR....



lebey kurang mcm ni la...

Jika user memilih TERIMA........dier akan simpan status="Temujanji Diterima" and status2= 1

Jika user memilih TOLAK........dier akan simpan status="Temujanji Ditolak" and status2=0


so mcm mane carenye nak simpan dlm db ek?...nak kene wat syarat ke ape?

[ Last edited by  pzan213 at 20-3-2009 03:28 ]
Reply

Use magic Report

Post time 21-3-2009 12:09 AM | Show all posts
mcm ni la...

page1
<form name="form1" method="post" action="page2.php">
&#160;<select name="status" id="status">
&#160;&#160; &#160;&#160; &#160;&#160; &#160;&#160;&#160;<option value="1">Terima</option>
&#160;&#160; &#160;&#160; &#160;&#160; &#160;&#160;&#160;<option value="0">Tolak</option>
&#160;&#160; &#160;&#160; &#160;&#160; &#160;</select>
&#160;&#160; &#160;&#160; &#160;&#160; &#160;<input name="Submit" type="submit" id="Submit" value="Hantar">


page2
$status=$_POST['status'];

if ($status = "1")
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {

&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; UPDATE temujanji&#160;&#160;SET status='Temujanji Anda Telah Dipersetujui. Sila datang pada hari dan tarikh yang telah ditetapkan.' and status2= '1' &#160; &#160;WHERE bil = '$bil' ";&#160;

}

else
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ($status = "0")
&#160;&#160; &#160; &#160; &#160; &#160;
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160;UPDATE temujanji&#160;&#160;SET status='Temujanji Anda Telah ditolak. Sila membuat temujanji pada waktu yang lain. Terima kasih' and status2= '0' WHERE bil = '$bil' ";&#160;

}


cane nak buat camni?kalo status 1 or 0 dier akan update mcm kat atas...

[ Last edited by  pzan213 at 21-3-2009 00:10 ]
Reply

Use magic Report

Post time 21-3-2009 12:44 AM | Show all posts
xpela..dah dpt
Reply

Use magic Report

Post time 25-3-2009 07:42 AM | Show all posts
Originally posted by BorderManager at 12-3-2009 01:34
n list kan semua nama.. tak berapa cantik
$conn&#160; &#160; = mysql_connect($host, $user, $passwd) or die(mysql_error());
$link&#160; &#160; = mysql_select_db($db, $conn) or die(mysql_error());
$pass_mark = 50;
...



board..kalo nak kira jumlah markah n jumlah gred cane?
Reply

Use magic Report


ADVERTISEMENT


Post time 25-3-2009 08:07 AM | Show all posts
buat mcm kat atas tu

1st create function - utk set kan mark sekian2 berapa grade dia

2nd call function tersebut

  1. <td<?= grade($row2['mark'])=='F'?' style="color:#FF0000"':''?>><?= grade($row2['mark']) ?></td>
Copy the Code
Reply

Use magic Report

Post time 25-3-2009 08:13 AM | Show all posts
Aku nak generate pdf file dari report2 yang aku buat.
Aku ada donwload 2-3 class pdf php tapi semuanya sangat2 blur dan banyak sangat coding.. aku bukan nak buat graf ke buat bulatan atau coloring bentuk cantik cantik... apa yang aku nak just apa yang report kuar tu lah yang kuar kat pdf.

Ada simple way tak?
Reply

Use magic Report

Post time 25-3-2009 10:02 AM | Show all posts
ko guna fpdf....

tapi buat pdf n memang pening, kalau aku org suruh buat report, 1 pdf tu paling kurang aku ambil RM300
Reply

Use magic Report

Post time 26-3-2009 02:13 AM | Show all posts
Originally posted by sadiq_segaraga at 25-3-2009 08:13
Aku nak generate pdf file dari report2 yang aku buat.
Aku ada donwload 2-3 class pdf php tapi semuanya sangat2 blur dan banyak sangat coding.. aku bukan nak buat graf ke buat bulatan atau colori ...



yg ni utk generate report file php kepada ms word...yg ni sample dier..try sample dulu..nanti baru ko paham cane nak simpan semua yg ader dlm report tu ke dalam ms word...

<?php&#160;

header("Content-Type: application/msword");&#160;
header("Content-Disposition: attachment; filename=\"file.doc\"");&#160;

?>&#160;
<html xmlns:w="urn:schemas-microsoft-comffice:word">&#160;
<head>&#160;
<title><?php echo(rand());?></title>&#160;

<style>&#160;
h1{font:16pt arial,sans-serif}&#160;
p{font:12pt arial,sans-serif}&#160;
</style>&#160;
</head>&#160;

<body>&#160;
<div>&#160;
<h1><o:p><?php echo(rand());?></o:p></h1>&#160;
<p><o:p><?php echo(rand());?></o:p></p>&#160;
</div>&#160;
</body>&#160;
</html>
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

10-1-2025 01:02 PM GMT+8 , Processed in 0.136962 second(s), 30 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list