Jump to content

piheshpi90

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

piheshpi90's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hello everyone. i'm having problem to create a search page. i want to create a search page like this but i dont have the coding source to refer.. can anyone give me the coding for me to refer.... Help Please [attachment deleted by admin]
  2. i want to create function that calculate worker that attend 6 days activity on year B and group it by their gred. so i use this coding but it give wrong result function countSix($a,$f) { $sql = "SELECT * FROM staf_info INNER JOIN aktiviti_staf ON staf_info.id=aktiviti_staf.id INNER JOIN aktiviti ON aktiviti_staf.id_aktiviti=aktiviti.id_aktiviti WHERE staf_info.id_kumpulan = '".$a."' AND year(tarikh_awal) LIKE '%".$f."'"; $query= mysql_query($sql) or die("Error: " .mysql_error()); $row=mysql_num_rows($query); $num=1; $f=0; if($row!=0) { while( $data=mysql_fetch_assoc($query)) { $b=$data['bil_hari']+$data['hari_kursus']; if($b == 6) { $e = countStaf($data['id'],$data['id_aktiviti']); $f = $f + $e; } } } return $f; } function countStaf($c,$d) { $sql = "SELECT COUNT(*) AS STAFCOUNT FROM aktiviti_staf WHERE id = '".$c."' AND id_aktiviti = '".$d."'"; $query= mysql_query($sql) or die("Error: " .mysql_error()); $row=mysql_num_rows($query); $result = mysql_fetch_array($query); return $result['STAFCOUNT']; } i can't seem to find the error.. help me please!! :'(
  3. if i want to echo the current year..how to do that?
  4. im trying to create sql that display data from current year.so im using datepart().but error says -->FUNCTION e_latihan.DATEPART does not exist. why it say like that.can anybody help me find a resolution? "SELECT * FROM aktiviti WHERE year(`tarikh_akhir`)=DATEPART(GETDATE()) OR year(`tarikh_awal`) = DATEPART(GETDATE()) ";
  5. thank you very much. it works now!! i guess the problem is casting it into integer. i'm realy glad you help me. thank you for your help. :D :D :D :D
  6. i thought it will represent the value i insert in the form $colname_Recordset3 = "-1"; if (isset($_POST['s'])) { $colname_Recordset3 = (get_magic_quotes_gpc()) ? $_POST['s'] : addslashes($_POST['s']); } $query_Recordset3 =sprintf( "SELECT * FROM aktiviti WHERE month(`date_n`) = s ", $colname_Recordset3); i try SELECT * FROM aktiviti WHERE MONTH(`date_n`) = 9 and it work.but when i change it to s, it doesnt. error say--> Unknown column 's' in 'where clause'.
  7. date_n in my table is save as date data type.. so it is save as YYYY-MM-DD format. i want my sql to extract MM value from YYYY-MM-DD so that if i key in 09, it will display data where MM value is equal to 09. :-\ :-\
  8. that does not help. it show all data. i try SELECT * FROM aktiviti WHERE month(`date_n`) = s; month(`date_n`) will return month value right?
  9. i want to select month from date.i try using datepart but it produce errors say -->FUNCTION book.DATEPART does not exist my sql is like below: "SELECT * FROM aktiviti WHERE DATEPART(MONTH,date_n) = 's' "; what is wrong?
  10. date in my database is save as (dd/mm/yyyy). now i want to create sql to search for activity for chosen month..how do i extract month from (dd/mm/yyyy) and include in sql?
  11. thank you so much for helping.i manage to view limited result lke i want.
  12. hello everyone.im learning php and need a lot of help from everyone. im hoping that everyone will help me with this language.
  13. my coding is displaying all result in only one page.i want to limit it to 50result per page..can anyone give the suitable coding? right now,im using this <?php do { ?> <?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?> <tr bgcolor="#CCCCCC"> <td height="21"><div align="center"><span class="style17"> <?php $count=$count + 1; echo $count; ?> </span></div></td> <td><div align="center" class="style17"><?php echo $row_Recordset1['id']; ?></div></td> <td><div align="left" class="style17"><?php echo $row_Recordset1['name']; ?></div></td> <td><div align="center" class="style17"><a href="staf_info.php?id=<?php echo $row_Recordset1['id']; ?>"><img src="pic/b_view.png" width="16" height="16" border="0" /></a></div></td> <td><div align="center" class="style17"><a href="kemaskini_staf.php?id=<?php echo $row_Recordset1['id']; ?>"><img src="pic/b_edit.png" width="16" height="16" border="0" /></a></div> <div align="center" class="style17"></div></td> <td><div align="center" class="style17"><a href="staf_delete.php?id=<?php echo $row_Recordset1['id']; ?>"><img src="pic/b_drop.png" alt="padam" width="16" height="16" border="0" /></a><a href="staf_delete.php?id=<?php echo $row_Recordset1['id']; ?>"></a></div></td> </tr> <?php } // Show if recordset not empty ?> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.