|
|||
generate report by month and year
leh sesape tolong aku tak...
aku nak combine 2 tables... 1. table register : empname 2. table transaction : empno, access_number, title, category, entry_date, status problem aku skarang ialah aku nak display report by month and year...bila aku combine 2 table tu ok tp bila aku letak condition.. WHERE year(entry_date)=$year and month(entry_date)=$month terus tak dapat... please somebody help me... Attach here is my coding for your reference.. thank you! <body bgcolor="#999999"> <? include ("connect.php") ; $month = $HTTP_POST_VARS ['requiredmonth']; $year = $HTTP_POST_VARS ['requiredyear']; $status1 = 'BORROW'; $query = "select register.empname, transaction.empno, transaction.access_number, transaction.title, transaction.category, transaction.status1, transaction.entry_date, transaction.due from register, transaction where transaction.empno=register.empno and `status1` = '". $status1 ."'" ; $result = mysql_query($query); $num=mysql_num_rows($result); if(mysql_num_rows($result)==0) { print "<SCRIPT LANGUAGE=\"JavaScript\">"; print "alert(\"DATA NOT EXIST IN DATABASE \")"; print "</SCRIPT>"; print "<SCRIPT LANGUAGE=\"JavaScript\">"; print "location.replace (\"report_borrow_month_year.php\")"; print "</SCRIPT>"; } else { echo " <td><center><font size=\"1\"><font color=\"blue\">MONTHLY BORROWING REPORT </center></td>"; echo " <td>MONTH : $month</td>\n"; echo " <td><br>YEAR : $year <br></td>\n"; echo " <td><br></td>\n"; echo "<table width=\"900\" border=\"1\" align=\"center\""; echo " <tr bgcolor=\"#DDDDDD\">"; echo " <td width=\"30\"> <center> <font size=\"1 \"> BIL </td>"; echo " <td width=\"200\"> <center> <font size=\"1\"> NAME </td>"; echo " <td width=\"50\"> <center> <font size=\"1\"> EMPLOYEE NUMBER</td>"; echo " <td width=\"150\"> <center> <font size=\"1\"> ACCESS NUMBER </td>"; echo " <td width=\"80\"> <center> <font size=\"1\"> TITLE </td>"; echo " <td width=\"80\"> <center> <font size=\"1\"> CATEGORY </td>"; echo " <td width=\"80\"> <center> <font size=\"1\"> STATUS </td>"; echo " <td width=\"60\"> <center> <font size=\"1\"> ENTRY DATE </td>\n"; echo " <td width=\"80\"> <center> <font size=\"1\"> DUE </td>\n"; echo " </tr>\n"; for($a = 1; $a <= $num; $a++) { if ($row=mysql_fetch_row($result)) { echo "<tr bgcolor=\"#EEEEEE\">\n"; echo " <td> <font size=\"1\"> <center>$a</center></td>\n"; echo " <td> <font size=\"1\"> $row[0]</td>\n"; echo " <td> <center> <font size=\"1\"> $row[1]</td>\n"; echo " <td><font size=\"1\"> $row[2]</td>\n"; echo " <td><center><font size=\"1\"> $row[3]</td>\n"; echo " <td> <font size=\"1\"> $row[4]</td>\n"; echo " <td> <center> <font size=\"1\"> $row[5]</td>\n"; echo " <td> <center> <font size=\"1\"> $row[6]</td>\n"; echo " <td> <center> <font size=\"1\" color=\"red\"> $row[7]</td>\n"; echo " </tr>\n"; } } } echo "</table> \n"; ?> |
|
|||
thanks lcf....
i got this error...... Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\library\report_borrow_month_yea r_action.php on line 19 select register.empname, transaction.empno, transaction.access_number, transaction.title, transaction.category, transaction.status1, transaction.entry_date, transaction.due from register, transaction where year(entry_date)=2004 and month(entry_date)=7 and transaction.empno=register.empno and `status1` = 'BORROW' Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\library\report_borrow_month_yea r_action.php on line 24 my table structure(fields) is like this..... 1. register table - empname - empno - address - phoneno - position - gender - entry_date (structure type: date like (2004-06-27)) 2. tranaction table - empno - category - title - access_number - status1 - entry_date - duedate - due |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using MySpace to generate Traffic | limcs | Other Internet Marketing Methods | 9 | 28-01-2008 06:18 PM |
| AsiaWebserver - Hosting RM 4 p/month / RM40 p/year | AsiaWebserver | Web Hosting Offers | 0 | 06-09-2006 06:21 PM |
| crytal report | linux_rock | Website Programming | 1 | 23-08-2005 05:22 PM |
| Limited Time Offer - 4GB Space Reseller Hosting - Only $19.95/month - Month to Month | Cash | Other Webmaster-related Services and Promotion | 0 | 13-04-2005 08:05 PM |
| Shared Hosting from $1.95/month & $19.50/year | Wickedboy | Other Webmaster-related Services and Promotion | 0 | 23-03-2005 02:09 AM |
All times are GMT +8. The time now is 11:52 PM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.













Linear Mode

