Jump to content

new_php85

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by new_php85

  1. example in database: startDate = '2008-11-04' i know if i put date(Y-m) it will be 2008-11 that's why in query i put % for day to neglect the value... is it wrong??
  2. hai... i have problem to select current month... this is my example coding for select current month. why its not appear. $current_month = date(Y-m); $query_cm = "SELECT * FROM cldr WHERE startDate like '$current_month-%' order by startDate desc"; $result_cm = mysql_query($query_cm) or die('Query failed. ' . mysql_error()); <form name="current_month" id="current_month" method = "post"> <table bordercolor="#EEF8D6" border="1" cellpadding="3" cellspacing="0" align="center"> <th width="14"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">No.</font></th> <th width="105"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Name</font></th> <th width="329"><div align="left"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Location</font></div></th> <th width="40"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Start Date</font></th> <th width="40"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">End Date</font></th> <th width="40"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Edit</font></th> <th width="46"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Delete</font></th> <?php $c=1; while($row = mysql_fetch_assoc($result_cm)) { ?> <tr> <td><div align="center"><?php echo $c?></div> <td><?php echo $row['staffKcc']?></td> <td><?php echo $row['location']?></td> <td><?php echo $row['startDate']?></td> <td><?php echo $row['endDate']?></td> <td><div align="center"><a href="editEvent.php?id=<?php echo $row['id']?>">Edit</a></div></td> <td><div align="center"><a href="deleteEvent.php?id=<?php echo $row['id']?>">Delete</a></div></td> </tr> <?php $c++; } ?> </table> </form> plz help me...
  3. haii...i new in js. i want ask why my coding not run. i use php and javascript. this is my sample coding Briefly description: start_date and closing_date retrieve from database and date_me will key in by user example start_date=2008-10-02 closing_date=2008-10-11 <script type="text/javascript"> function validDate(me) { var prob=false; if(me.date_me.value=="") { alert("Please enter date"); prob=true; } if(me.date_me.value>me.closing_date.value) { alert("Please enter valid date"); prob=true; } if(me.date_me.value<me.start_date.value) { alert("Please enter valid date. The date are entered already close"); } if(prob) { return false; } else { return true; } } </script> When user key in date_me>closing_date(2008-10-11)the program is success. then only 2008-10-11 and 2008-10-10 can add by user in database. why below then 2008-10-10(2008-10-9, 2008-10-8 and so on) user still cannot add (error massege appear "Please enter valid date").i thought if date_me>closing_date(2008-10-11), all date below than 2008-10-11 which are 10,9,8,7,6,5 oct 2008 still can add. by why only 10 and 11 october. then for date_me<start_date(2008-10-02) why when i put 2008-09-01 it still can add. suppose error mesage will appear "Please enter valid date". i dont know if i forgot something.can you help me. plzzzzzzzz ??? ??? ???
  4. i...i have some problem to control entry date.i want, user cannot add claim when the "date_me" have over limit which the date is not valid anymore. for example date_me only can accept date in october but after october the date is not valid.currently i only use like this.but i think there is some better code. this is is my example coding <?php session_start(); include 'includes/db_connect.php'; include 'includes/css.php'; if (isset($_POST['bttnAdd'])) { $me_id = $_POST['me_id']; $staff_id = $_POST['staff_id']; $date_me = $_POST['date_me']; $particular = $_POST['particular']; $bill_me = $_POST['bill_me']; $ammount_me = $_POST['ammount_me']; $data = 1; $query = "INSERT INTO me(staff_id, date_me, particular, bill_me, ammount_me) VALUES('$staff_id','$date_me','$particular','$bill_me','$ammount_me') WHERE date_me != '2008-10-28'"; mysql_query($query) or die('Query failed. ' . mysql_error()); echo "<script language='JavaScript'> alert('The record is successfully added');</script>"; echo "<script language='JavaScript'> window.location ='me.php';</script>"; } ?> <form name="me" action='me.php' method = "post" onSubmit="return validateForm(this,arrFormValidation);"> <table width="678" align="center"> <tr> <td height="20" colspan="2" class="tajukkecil"><b>Miscellaneous Expense</b></td> </tr> <tr> <td width="85">Date</td> <td width="581">: <input class="special" type="text" name = "date_me" maxlength = "10" size = "16"><a href="Javascript:ShowCalendar('document.me.date_me',1900,2030,'dd-mm-yyyy');"><img src="pic/ew_calendar.gif"></a> <input class="special" type = "hidden" name = "staff_id" value = "<?php echo $_SESSION['staff_id']?>" Readonly></td> </tr> <tr> <td width="85">Particular</td> <td width="581">: <input class="special" name = "particular" maxlength = "150" size = "46"></td> </tr> <tr> <td width="85">Bill No.</td> <td width="581">: <input class="special" name = "bill_me" maxlength = "15" size = "16"></td> </tr> <tr> <td width="85">Amount</td> <td width="581">: RM <input class="special" name = "ammount_me" maxlength = "7" size = "10"></td> </tr> <tr> <td> </td> <td align="left"> <div align="left"> <input class="button" type = "button" name = "bttnList" value = "List Miscellaneous Expenses" onClick="listMe()"> <input class="button" type = "submit" name = "bttnAdd" value = "Add"> <input class="button" type = "reset" name = "bttnCancel" value = "Reset"> </div></td> </tr> </table>
  5. ii... i got this warning. what happen ya? Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO)in C:\wamp\www\new\create.php on line 6 Access denied for user 'ODBC'@'localhost' (using password: NO) this is sample code untill line 7 <?php require("config.php"); require("./lang/lang.admin." . LANGUAGE_CODE . ".php"); mysql_connect(hostdb, userdb, passdb) or die(mysql_error()); mysql_select_db(namedb) or die(mysql_error());
  6. i every body... i need your opinion about drop down list. this is my sample code for drop down list Destination <select class="special" name="dest"> <option value="" selected>Choose Destination <option value="SZB">SZB <option value="MEL">MEL <option value="KCH">KCH <option value="KTN">KTN <option value="JHB">JHB <option value="BKI">BKI <option value="SBW">SBW <option value="MYY">MYY <option value="KBR">KBR <option value="IPH">IPH <option value="AOR">AOR <option value="TGG">TGG <option value="PEN">PEN <option value="BTL">BTL</select> Know i want change to.... Destination <select class="special" name="dest"> <option value="" selected>Add new destination <option value="SZB">SZB <option value="MEL">MEL <option value="KCH">KCH <option value="KTN">KTN <option value="JHB">JHB <option value="BKI">BKI <option value="SBW">SBW <option value="MYY">MYY <option value="KBR">KBR <option value="IPH">IPH <option value="AOR">AOR <option value="TGG">TGG <option value="PEN">PEN <option value="BTL">BTL</select> i want to know is it possible if when user click at "Add new destination" the statement come out with text field which is user need to key in the new destination where not in the list... if cannot do you have any suggestion how i need to make user able to add new destination for international. because the current list is for domestic... ??? thank you...
  7. thank you... yes i got it but how come if i need to view uploaded file.because as i know the uploaded files are keep at one folder for example: this is information that i need to save <?php $query = "INSERT INTO pe(staff_id, date_pe, odometer, mileage, receipt, shell, cash, tp_pe) VALUES('$staff_id','$date_pe','$odometer','$mileage','$receipt','$shell','$cash','$tp_pe')"; mysql_query($query) or die('Query failed. ' . mysql_error()); ?> <form name="pe" action='pe.php' method = "post" onSubmit="return validateForm(this,arrFormValidation);"> <table width="679" align="center"> <tr> <td height="20" colspan="2" class="tajukkecil"><b>Petrol Expense</b></td> </tr> <tr> <td width="119">Date</td> <td width="413">: <input class="special" type="text" name = "date_pe" maxlength = "10" size = "16"><a href="javascript:ShowCalendar('document.pe.date_pe',1900,2030,'dd-mm-yyyy');"><img src="pic/ew_calendar.gif"></a> <input class="special" type = "hidden" name = "staff_id" value = "<?php echo $_SESSION['staff_id']?>" Readonly></td> </tr> <tr> <td width="119">Odometer</td> <td width="413">: <input class="special" name = "odometer" maxlength = "7" size = "16"></td> </tr> <tr> <td width="119">Mileage</td> <td width="413">: <input class="special" name = "mileage" maxlength = "200" size = "46"></td> </tr> <tr> <td width="119">Official Receipt No.</td> <td width="413">: <input class="special" name = "receipt" maxlength = "200" size = "16"> Choose a file to upload: <input name="uploadedfile" type="file"> <input type="submit" value="Upload File"></td> </tr> <tr> <td width="119">By Shell Card</td> <td width="413">: RM <input class="special" name = "shell" maxlength = "200" size = "10"> By Cash : RM <input class="special" name = "cash" maxlength = "200" size = "10"></td> </tr> <tr> <td>Toll/Parking</td> <td>: RM <input class="special" type = "float" name = "tp_pe" maxlength = "10" size = "10" value = ""></td> </tr> <tr> <td> </td> <td align="left"><input class="button" type = "button" name = "bttnList" value = "List Petrol Expenses" onClick="listPe()"> <input class="button" type = "submit" name = "bttnAdd" value = "Add"> <input class="button" type = "reset" name = "bttnCancel" value = "Reset"></td> </tr> </table> </form> and then this is for view <?php $y=1; while($row = mysql_fetch_assoc($result)) { ?> <tr> <td><div align="center"><?php echo $y;?></div></td> <td><?php echo $row['date_pe']?></td> <td><div align="left"><?php echo $row['odometer']?></div></td> <td><div align="left"><?php echo $row['mileage']?></div></td> <td><div align="left"><?php echo $row['receipt']?></div></td> <td width="22"><div align="left">RM</div></td> <td width="68"><div align="right"><?php echo round($row['shell'],2)?></div></td> <td width="21"><div align="left">RM</div></td> <td width="32"><div align="right"><?php echo round($row['cash'],2)?></div></td> <td width="23"><div align="left">RM</div></td> <td width="65"><div align="right"><?php echo round($row['tp_pe'],2)?></div></td> <td width="23"><div align="left">RM</div></td> <td width="65"><div align="right"><?php echo round($row['ammount_pe'],2)?></div></td> <td><div align="center"><a href="editPe.php?pe_id=<?php echo $row['pe_id']?>">Edit</a></div></td> <td><div align="center"><a href="deletePe.php?pe_id=<?php echo $row['pe_id']?>">Delete</a></div></td> </tr> <?php $y++; } ?> the how come uploaded file can view??/
  8. ii.... i use this function for print report <input class="button" type="button" name="bttnPrint" value="Print" onClick="if (window.print) window.print()"> but this function same like usual at web browser which is file-->print. i would like to know is that have any function that i can use for print document????
  9. ii... i dont know how to upload file. i tried to search and i still catch up. how ya? plz???
  10. yes there some whitespace at my code. i have change my code and now the warning disappear. ;)thank for help
  11. ii.... i new in system development. i have a system in webserver. than i have another system to add at current sytem. current system use other database for example kkkdb and the new system use other database such as mecdb. the address for original web is http://www.XXXXX.com.my and for sub is http://www.XXXXX.com.my/xxxxxExpensesxxxxx when i try to log on i got this message <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'mecdb'; mysql_select_db($dbname); ?> after put at server my friend change to <?php $dbhost='localhost'; $dbuser='XXXXX'; $dbpass='XXXXX'; $conn=mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname='XXXXX'; mysql_select_db($dbname); ?> i dont know to solve this problem. how come this message "Query failed. Table 'XXX_XXX.staff_info' doesn't exist" appear
  12. why the system that i develop can run at my pc but after put on server i have this warning Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/XXXXX/public_html/XXXXXClaim/db_connect.php:10) in /home/XXXXX/public_html/XXXXX/index.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/XXXXX/public_html/XXXXXClaim/db_connect.php:10) in /home/XXXXX/public_html/XXXXXClaim/index.php on line 3 i already go to a forum that have same problem but it still not working this is link for the forum http://www.php-forum.com/phpforum/viewtopic.php?f=2&t=9229
  13. i... thank you for your information.i have try but also not working.i don't why it still not working
  14. iii...... i need help how to enable other pc to access php file at pc where installed apache and mysql.for example pcA install both apache and mysql but pcB not. How pcB can access php file at PcA. usually, if pcA want to read php file at his own pc, the url is like thid: http://localhost/mec/index.php. but how about pcB??? ??? ???
  15. i... thank you for your info. i got it..........
  16. Hay.... may I know what the purpose for * at your code memberName = *username_here*
  17. iii how to get value from database for dropdown list <select class="special" name="year"> <option value="" selected>Staff Name <option value="<?php echo $row['staff_name']?>" ><?PHP while($row = mysql_fetch_assoc($result)) { echo $row['staff_name']; }?> </select> this is code that i have done. it appear but the name not go down like JosephJoLinaAlex suppose like this Joseph Jo Lina Alex
  18. iiii see again.... i have problem to search data by month and year... little bit explanation: end user need to select month and year in order to search the record.both month and year using drop down named month and year. this is sample code that i have made.. if (isset($_POST['month'])) && (isset($_POST['year']))) {( $month=$_POST['month']; $year=$_POST['year']; if($year=='year') && ($month=='month') { $q = "SELECT * FROM pe WHERE staff_id='$staff_id' AND month like '%$month%' AND year like '$year%'"; $result = mysql_query($q) or die('Query failed. ' . mysql_error()); $q2 = "SELECT SUM(shell) AS total_shell FROM pe WHERE staff_id='$staff_id' AND month like '%$month%' AND year like '$year%'"; $result2 = mysql_query($q2) or die('Query failed. ' . mysql_error()); $row2 = mysql_fetch_array($result2); $q3 = "SELECT SUM(cash) AS total_cash FROM pe WHERE staff_id='$staff_id' AND month like '%$month%' AND year like '$year%'"; $result3 = mysql_query($q3) or die('Query failed. ' . mysql_error()); $row3 = mysql_fetch_array($result3); $q4 = "SELECT SUM(tp_pe) AS total_tp_pe FROM pe WHERE staff_id='$staff_id' AND month like '%$month%' AND year like '$year%'"; $result4 = mysql_query($q4) or die('Query failed. ' . mysql_error()); $row4 = mysql_fetch_array($result4); } else { $q = "SELECT * FROM pe WHERE staff_id='$staff_id'"; $result = mysql_query($q) or die('Query failed. ' . mysql_error()); $q2 = "SELECT SUM(shell) AS total_shell FROM pe WHERE staff_id='$staff_id'"; $result2 = mysql_query($q2) or die('Query failed. ' . mysql_error()); $row2 = mysql_fetch_array($result2); $q3 = "SELECT SUM(cash) AS total_cash FROM pe WHERE staff_id='$staff_id'"; $result3 = mysql_query($q3) or die('Query failed. ' . mysql_error()); $row3 = mysql_fetch_array($result3); $q4 = "SELECT SUM(tp_pe) AS total_tp_pe FROM pe WHERE staff_id='$staff_id'"; $result4 = mysql_query($q4) or die('Query failed. ' . mysql_error()); $row4 = mysql_fetch_array($result4); } } ?> Why i can't get the output ??? ??? ???
  19. hi... everybody... i need some help ??? ??? ??? here is some situation...i create some program using php.end user can be categorize as HOD (head of department) and NON_HOD. HOD have their own area and same with NON_HOD.when HOD log on to the page, the system will come out with the list of NON_HOD with same area. how come to solve this problem?how to read the current area for user who logon to the system then use it to retrieve other user name that have same area with the current page. the query that i know only this... $q_ha="SELECT staff_name FROM staff_info WHERE HOD='NO'" $res_ha = mysql_query($q_ha) or die('Query failed. ' . mysql_error()); ??? ???
×
×
  • 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.