PHP - Charset Problem When Saving To My Db
Similar Tutorialshi i am calling some text from a database with php and echoing it to flash. i have no idea the charset anything is in. all i can see is that calling the text from the database and placing into flash yields in some missing chars, but if echo the called text to the browser, copy it and echo that to flash, all characters appear. now, i kow this is not a flash forum, and im not going to ask for a flash solution because there's just too many different charsets and code i cannot control/ nor see so i was thinking of doing something along the line of having php creating a clone of the copied text that appears in the browser, and having it echo that text to flash. it there something php can do, similar to what i described? regards Hi... I create a payroll system and now I have an issue or problem in saving data before I save data using save button now i want to save data when clicking the employee name at the navigalist list from the left side. Here is my code for the searching and displaying employee name at navigation list: Here is my code for search.php: Code: [Select] <?php session_start(); include 'config.php'; $queryString = $_GET["query"]; if ($queryString == "" || $queryString == null) { $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') AS FULLNAME FROM PERSONAL ORDER BY FULLNAME ASC"; } else { $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') AS FULLNAME FROM PERSONAL WHERE CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') LIKE '" . $queryString . "%' ORDER BY FULLNAME ASC"; } $recPersonalQuery = $conn->Execute($sql); if (!$recPersonalQuery->BOF) { $recPersonalQuery->MoveFirst(); } echo "<hr />"; echo "<ul>"; while (!$recPersonalQuery->EOF) { $empID = $recPersonalQuery->fields["EMP_ID"]; $empFullName = $recPersonalQuery->fields["FULLNAME"]; echo "<li onclick=changeEmployeePay('$empID'); >$empFullName</li>"; //echo "<li onkeyup=changeEmployeePay('$empID'); >$empFullName</li>"; echo "<hr />"; $recPersonalQuery->MoveNext(); } echo "</ul>"; $recPersonalQuery->Close(); exit(); ?> here is the javascript code and the template for displaying employee name list: Code: [Select] <html> <head> <title></title> <script> function searchemppay(queryString) { var ajaxRequest = remoteRequestObject(); ajaxRequest.onreadystatechange = function() { if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) { var result = ajaxRequest.responseText; document.getElementById('searchpayroll').innerHTML = result; } } var url = "search.php?query=" + queryString; ajaxRequest.open("GET", url, true); ajaxRequest.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); ajaxRequest.send(null); } function changeEmployeePay(queryID) { window.location = "SearchData.php?queryEmpID=" + queryID; } </script> </head> <body> <div id="Search"> <form> <p class="serif"><b>Search Lastname:</b></p> <input type="text" name="search_" size="20" onkeyup="searchemppay(this.value);"> <div id="searchpayroll" style="overflow:auto; height:390px; width:auto; margin-left:2px" > <hr /> <ul> {section name=co_emp loop=$personalAll} <li onclick="changeEmployeePay('{$personalAll[co_emp].EMP_ID}')">{$personalAll[co_emp].FULLNAME}</li> <!--<li onkeyup="changeEmployeePay('{$personalAll[co_emp].EMP_ID}')">{$personalAll[co_emp].FULLNAME}</li>--> <hr /> {sectionelse} <li>No records found</li> {/section} </ul> </div> </div> </body> </html> and here is the code for displaying employee data Code: [Select] <?php include 'config.php'; $currentEmpID = $_SESSION['empID']; $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME FROM PERSONAL ORDER BY LNAME ASC"; $recPersonalNav = $conn->GetAll($sql); $smarty->assign('personalAll', $recPersonalNav); $EMP_NO = $_POST['EMP_NO']; $sql = "SELECT em.EMP_NO, p.EMP_ID, CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') AS FULLNAME FROM PERSONAL p, EMPLOYMENT em WHERE p.EMP_ID='$currentEmpID' AND em.EMP_ID = '$currentEmpID'"; $recPersonalHead = $conn->Execute($sql); $fullName = $recPersonalHead->fields["FULLNAME"]; $empno = $recPersonalHead->fields["EMP_NO"]; $smarty->assign('empid', $currentEmpID); $smarty->assign('fullname', $fullName); $smarty->assign('empno', $empno); $sql = "SELECT EMP_ID, RATE FROM wage WHERE EMP_ID = '$currentEmpID'"; $rsWage = $conn->Execute($sql); $Rate = $rsWage->fields['RATE']; $sql = "SELECT EMP_ID,EMP_NO, STATUS FROM employment WHERE EMP_ID = '$currentEmpID'"; $rsStatus = $conn->Execute($sql); $STATUS = $rsStatus->fields['STATUS']; $EMP_ID = $rsStatus->fields['EMP_ID']; $sql = "SELECT em.EMP_NO, em.STATUS, w.RATE, r.Hours, o.OT_Hours FROM $ADODB_DB.employment AS em INNER JOIN $ADODB_DB.wage AS w ON em.EMP_ID = w.EMP_ID LEFT JOIN $PAYROLL.regular_sum_hours AS r ON em.EMP_NO = r.EMP_NO LEFT JOIN $PAYROLL.ot_data AS o ON r.EMP_NO = o.EMP_NO WHERE em.EMP_ID = '$currentEmpID' AND o.STATUS = 'Offset'"; $RsEarnings = $conn2->Execute($sql); $Rate = $RsEarnings->fields['RATE']; $Hours = $RsEarnings->fields['Hours']; $Offset = $RsEarnings->fields['OT_Hours']; $Hours = substr($Hours, 0, 5); $Hours = str_replace(':', '.', $Hours); $Hours = ($Hours + $Offset); $Amount = $_POST["Amount"]; $Amount = round(($Hours/8)* $Rate, 2); $smarty->assign('Rate', $Rate); $smarty->assign('Hours', $Hours); $smarty->assign('Amount', $Amount); $sql = "SELECT em.EMP_NO, o.OT_Category, SUM(OT_Hours) AS OT_Hours, o.STATUS FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category = 'RegularOvertime' AND o.STATUS = 'Overtime' AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $OTReg_Hours = $rsOTData->fields['OT_Hours']; $OTReg_Hours = round($OTReg_Hours, 2); $OTReg_Amt = round((($Rate / 8 * 1.3) * $OTReg_Hours), 2); $smarty->assign('OTReg_Hours', $OTReg_Hours); $smarty->assign('OTReg_Amt', $OTReg_Amt); $sql = "SELECT em.EMP_NO, o.OT_Category, SUM(OT_Hours) AS OT_Hours FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category = 'SundayRegular' AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $SunReg_Hours = $rsOTData->fields['OT_Hours']; $SunReg_Hours = round($SunReg_Hours, 2); $SunReg_Amt = round((($Rate / 8 * 1.35) * $SunReg_Hours), 2); $smarty->assign('SunReg_Hours', $SunReg_Hours); $smarty->assign('SunReg_Amt', $SunReg_Amt); $sql = "SELECT em.EMP_NO, o.OT_Category, SUM(OT_Hours) AS OT_Hours FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category = 'SundayOvertime' AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $OTSun_Hours = $rsOTData->fields['OT_Hours']; $OTSun_Hours = round($OTSun_Hours, 2); $OTSun_Amt = round((($Rate / 8 * 1.35 * 1.35) * $OTSun_Hours), 2); $smarty->assign('OTSun_Hours', $OTSun_Hours); $smarty->assign('OTSun_Amt', $OTSun_Amt); $sql = "SELECT em.EMP_NO, o.OT_Category, SUM(OT_Hours) AS OT_Hours FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category = 'HolidayRegular' AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $HolReg_Hours = $rsOTData->fields['OT_Hours']; $HolReg_Hours = round($HolReg_Hours, 2); $HolReg_Amt = round((($Rate / 8 * 1.5) * $HolReg_Hours), 2); $smarty->assign('HolReg_Hours', $HolReg_Hours); $smarty->assign('HolReg_Amt', $HolReg_Amt); $sql = "SELECT em.EMP_NO, o.OT_Category, SUM(OT_Hours) AS OT_Hours FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category = 'HolidayRegularOvertime' AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $HolRegOT_Hours = $rsOTData->fields['OT_Hours']; $HolRegOT_Hours = round($HolRegOT_Hours, 2); $HolRegOT_Amt = round((($Rate / 8 * 2.05 * 1.35) * $HolRegOT_Hours), 2); $smarty->assign('HolRegOT_Hours', $HolRegOT_Hours); $smarty->assign('HolRegOT_Amt', $HolRegOT_Amt); $sql = "SELECT em.EMP_NO, SUM(l.HOURS_LEAVE) AS HOURS_LEAVE FROM $PAYROLL.leave_data l, $ADODB_DB.employment em WHERE em.EMP_NO = l.EMP_NO AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $HolLeave_Hours = $rsOTData->fields['HOURS_LEAVE']; $HolLeave_Hours = round($HolLeave_Hours, 2); $HolLeave_Amt = round((($Rate) * $HolLeave_Hours), 2); $smarty->assign('HolLeave_Hours', $HolLeave_Hours); $smarty->assign('HolLeave_Amt', $HolLeave_Amt); $sql = "SELECT em.EMP_NO, o.OT_Category, SUM(OT_Hours) AS OT_Hours FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category = 'NightPremiumRegular' AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $NPReg_Hours = $rsOTData->fields['OT_Hours']; $NPReg_Hours = round($NPReg_Hours, 2); $NPReg_Amt = round((($Rate / 8 * 0.15) * $NPReg_Hours), 2); $sql = "SELECT em.EMP_NO, o.OT_Category, SUM(OT_Hours) AS OT_Hours FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category = 'NightPremiumSunday' AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $NPSun_Hours = $rsOTData->fields['OT_Hours']; $NPSun_Hours = round($NPSun_Hours, 2); $NPSun_Amt = round((($Rate / 8 * 1.35 * 0.15) * $NPSun_Hours), 2); $sql = "SELECT em.EMP_NO, o.OT_Category, SUM(OT_Hours) AS OT_Hours FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category = 'NightPremiumHoliday' AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $NPHol_Hours = $rsOTData->fields['OT_Hours']; $NPHol_Hours = round($NPHol_Hours, 2); $NPHol_Amt = round((($Rate / 8 * 2.05 * 0.15) * $NPHol_Hours), 2); $NP_Hours = round(($NPReg_Hours + $NPSun_Hours + $NPHol_Hours), 2); $NP_Hours = round($NP_Hours, 2); $NP_Amt = round(($NPReg_Amt + $NPSun_Amt + $NPHol_Amt), 2); $smarty->assign('NP_Hours', $NP_Hours); $smarty->assign('NP_Amt', $NP_Amt); $sql = "SELECT COUNT(o.EMP_NO) AS EMP_NO, o.OT_Category, o.OT_Hours, o.STATUS FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category IN ('RegularOvertime', 'HolidayRegular', 'HolidayRegularOvertime') AND o.OT_Hours > 2 AND em.EMP_ID = '$currentEmpID' AND o.STATUS = 'Overtime' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $MealReg_Hours = $rsOTData->fields['EMP_NO']; $MealReg_Hours = round($MealReg_Hours, 2); $MealReg_Amt = round(($MealReg_Hours * 23), 2); $sql = "SELECT COUNT(o.EMP_NO) AS EMP_NO, o.OT_Category, o.OT_Hours FROM $PAYROLL.ot_data o, $ADODB_DB.employment em WHERE em.EMP_NO = o.EMP_NO AND o.OT_Category IN ('SundayRegular', 'SundayOvertime') AND o.OT_Hours > 2 AND em.EMP_ID = '$currentEmpID' GROUP BY em.EMP_NO"; $rsOTData = $conn2->Execute($sql); $MealSun_Hours = $rsOTData->fields['EMP_NO']; $MealSun_Hours = round($MealSun_Hours, 2); $MealSun_Amt = round(($MealSun_Hours * 30), 2); $Meal_Hours = round(($MealReg_Hours + $MealSun_Hours), 2); $Meal_Amt = round(($MealReg_Amt + $MealSun_Amt), 2); $smarty->assign('Meal_Hours', $Meal_Hours); $smarty->assign('Meal_Amt', $Meal_Amt); $sql = "SELECT COUNT(a.EMP_NO) AS EMP_NO, w.RATE FROM $ADODB_DB.wage w, $ADODB.employment em, $PAYROLL.attendance a WHERE em.EMP_NO = a.EMP_NO AND w.RATE = 302 AND em.EMP_ID = '$currentEmpID' GROUP BY w.RATE"; $rsOTData = $conn2->Execute($sql); $Cola_Hours = $rsOTData->fields['EMP_NO']; $Cola_Hours = round($Cola_Hours, 2); $Cola_Amt = round(($Cola_Hours * 28), 2); $smarty->assign('Cola_Hours', $Cola_Hours); $smarty->assign('Cola_Amt', $Cola_Amt); $TotEarn = $_POST['TotEarn']; $TotEarn = round(($Amount + $OTReg_Amt + $SunReg_Amt + $OTSun_Amt + $HolReg_Amt + $HolRegOT_Amt + $HolLeave_Amt + $NP_Amt + $Meal_Amt + $Cola_Amt), 2); $smarty->assign('TotEarn', $TotEarn); $HDMF = $_POST['HDMF']; $sql = "SELECT Ref_No, Range FROM $PAYROLL.hdmf, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID'"; $rs = $conn2->Execute($sql); $Range = $rs->fields['Range']; if ($TotEarn <= $Range) { $HDMF = round(($TotEarn * 0.01), 2); } else { $HDMF = round(($TotEarn * 0.02), 2); } $smarty->assign('HDMF', $HDMF); $SSS = $_POST['SSS']; $sql = "SELECT Ref_No, From_Range, To_Range, Employee_Share FROM $PAYROLL.sss, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID' AND $TotEarn BETWEEN From_Range AND To_Range"; $rs = $conn2->Execute($sql); $SSS = $rs->fields['Employee_Share']; $smarty->assign('SSS', $SSS); $PCHL = $_POST['PCHL']; $sql = "SELECT Ref_No, From_Range, To_Range, Employee_Share FROM $PAYROLL.pchl, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID' AND $TotEarn BETWEEN From_Range AND To_Range"; $rs = $conn2->Execute($sql); $PCHL = $rs->fields['Employee_Share']; $smarty->assign('PCHL', $PCHL); $TAX = $_POST['TAX']; $sql = "SELECT EMP_ID, EMP_NO, W4_STATUS, DEPENDENTS FROM employment WHERE EMP_ID = '$currentEmpID'"; $rsTax = $conn->Execute($sql); $W4_STATUS = $rsTax->fields['W4_STATUS']; $DEPENDENTS = $rsTax->fields['DEPENDENTS']; if($W4_STATUS == 1 AND $DEPENDENTS == 0 AND $TotEarn >= 0 AND $TotEarn <= 2083){ $TAX = round($TotEarn * .05); } elseif($W4_STATUS == 2 AND $DEPENDENTS == 0 AND $TotEarn >= 0 AND $TotEarn <= 2083){ $TAX = round($TotEarn * .05); } elseif($W4_STATUS == 1 AND $DEPENDENTS == 0 AND $TotEarn >= 2083 AND $TotEarn <= 2500) { $TAX = round($TotEarn - 2083); $TAX = round(20.83 + ($TAX * .10)); } elseif($W4_STATUS == 2 AND $DEPENDENTS == 0 AND $TotEarn >= 2083 AND $TotEarn <= 2500) { $TAX = round($TotEarn - 2083); $TAX = round(20.83 + ($TAX * .10)); } elseif($W4_STATUS == 1 AND $DEPENDENTS == 0 AND $TotEarn >= 2500 AND $TotEarn <= 3333) { $TAX = round($TotEarn - 2500); $TAX = round(104.17 + ($TAX * .15)); } else{ $TAX = round(0); } $smarty->assign('TAX', $TAX); $sql = "SELECT s.EMP_NO, s.SSSAmor FROM $PAYROLL.sssloan s, $ADODB_DB.employment em WHERE em.EMP_NO = s.EMP_NO AND em.EMP_ID = '$currentEmpID'"; $RsDed = $conn2->Execute($sql); $SSSAmor = round($RsDed->fields['SSSAmor']); $sql = "SELECT h.EMP_NO, h.HDMFAmor FROM $PAYROLL.hdmfloan h, $ADODB_DB.employment em WHERE em.EMP_NO = h.EMP_NO AND em.EMP_ID = '$currentEmpID'"; $RsHDMF = $conn2->Execute($sql); $HDMFAmor = round($RsHDMF->fields['HDMFAmor']); $sql = "SELECT u.EMP_NO, u.UDTAmor FROM $PAYROLL.udtloan u, $ADODB_DB.employment em WHERE em.EMP_NO = u.EMP_NO AND em.EMP_ID = '$currentEmpID'"; $RsUDT = $conn2->Execute($sql); $UDTAmor = round($RsUDT->fields['UDTAmor']); $TotalDed = $_POST['TotalDed']; $sql = "SELECT o.EMP_NO, o.BurialSeparationCont, o.TaxAjt, o.CashAdvance, o.AdvanceShirt, o.AdvanceMed, o.AdvanceOther FROM $PAYROLL.other_deductions o, $ADODB_DB.personal p, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID' AND em.EMP_NO = o.EMP_NO"; $rsOtherDed = $conn2->Execute($sql); $BurialSep = round($rsOtherDed->fields['BurialSeparationCont']); $TaxAjt = round($rsOtherDed->fields['TaxAjt']); $CashAdvance = round($rsOtherDed->fields['CashAdvance']); $AdvancesShirt = round($rsOtherDed->fields['AdvanceShirt']); $AdvancesMed = round($rsOtherDed->fields['AdvanceMed']); $AdvancesOthers = round($rsOtherDed->fields['AdvanceOther']); $smarty->assign('BurialSep', $BurialSep); $smarty->assign('TaxAjt', $TaxAjt); $smarty->assign('CashAdvance', $CashAdvance); $smarty->assign('AdvancesShirt', $AdvancesShirt); $smarty->assign('AdvancesMed', $AdvancesMed); $smarty->assign('AdvancesOthers', $AdvancesOthers); $TotalDed = round(($SSS + $HDMF + $PCHL + $TAX + $SSSAmor + $HDMFAmor + $UDTAmor + $BurialSep + $TaxAjt + $CashAdvance + $AdvancesShirt + $AdvancesMed + $AdvancesOthers), 2); $smarty->assign('SSSAmor', $SSSAmor); $smarty->assign('HDMFAmor', $HDMFAmor); $smarty->assign('UDTAmor', $UDTAmor); $smarty->assign('TotalDed', $TotalDed); $THP = $_POST["TakeHomePay"]; $THP = round($TotEarn - $TotalDed, 2); $smarty->assign('THP', $THP); $sql = "SELECT EMP_NO, OTReg_Amt, SunReg_Amt, OTSun_Amt, HolReg_Amt, HolRegOT_Amt, HolLeave_Amt, NP_Amt, Meal_Amt, Cola_Amt FROM other_earnings WHERE EMP_NO = '$empno'"; $RsOtherEarnings = $conn2->Execute($sql); $numrowsOtherEarnings = $RsOtherEarnings->RecordCount(); if($numrowsOtherEarnings > 0){ $saverec['EMP_NO'] = $empno; $saverec['OTReg_Amt'] = $OTReg_Amt; $saverec['SunReg_Amt'] = $SunReg_Amt; $saverec['OTSun_Amt'] = $OTSun_Amt; $saverec['HolReg_Amt'] = $HolReg_Amt; $saverec['HolRegOT_Amt'] = $HolRegOT_Amt; $saverec['HolLeave_Amt'] = $HolLeaveAmt; $saverec['NP_Amt'] = $NP_Amt; $saverec['Meal_Amt'] = $Meal_Amt; $saverec['Cola_Amt'] = $Cola_Amt; $updateOtherEarnings = $conn2->GetUpdateSQL($RsOtherEarnings, $saverec); $conn2->Execute($updateOtherEarnings); } else{ $sql = "SELECT o.EMP_NO, o.OTReg_Amt, o.SunReg_Amt, o.OTSun_Amt, o.HolReg_Amt, o.HolRegOT_Amt, o.HolLeave_Amt, o.NP_Amt, o.Meal_Amt, o.Cola_Amt FROM $PAYROLL.other_earnings o, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID'"; $RsOtherEarnings = $conn2->Execute($sql); $saverec['EMP_NO'] = $empno; $saverec['OTReg_Amt'] = $OTReg_Amt; $saverec['SunReg_Amt'] = $SunReg_Amt; $saverec['OTSun_Amt'] = $OTSun_Amt; $saverec['HolReg_Amt'] = $HolReg_Amt; $saverec['HolRegOT_Amt'] = $HolRegOT_Amt; $saverec['HolLeave_Amt'] = $HolLeaveAmt; $saverec['NP_Amt'] = $NP_Amt; $saverec['Meal_Amt'] = $Meal_Amt; $saverec['Cola_Amt'] = $Cola_Amt; $insertOtherEarnings = $conn2->GetInsertSQL($RsOtherEarnings, $saverec); $conn2->Execute($insertOtherEarnings); } $sql = "SELECT EMP_NO, SSS, TAX, PCHL, HDMF FROM deductions WHERE EMP_NO = '$empno'"; $RsDeduction = $conn2->Execute($sql); $numrowsDeduction = $RsDeduction->RecordCount(); if($numrowsDeduction > 0){ $saverec['EMP_NO'] = $empno; $saverec['SSS'] = $SSS; $saverec['TAX'] = $TAX; $saverec['PCHL'] = $PCHL; $saverec['HDMF'] = $HDMF; $updateDeductionSQL = $conn2->GetUpdateSQL($RsDeduction, $saverec); $conn2->Execute($updateDeductionSQL); } else{ $sql = "SELECT d.EMP_NO, d.SSS, d.TAX, d.PCHL, d.HDMF FROM $PAYROLL.deductions d, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID'"; $RsDeduction = $conn2->Execute($sql); $saverec['EMP_NO'] = $empno; $saverec['SSS'] = $SSS; $saverec['TAX'] = $TAX; $saverec['PCHL'] = $PCHL; $saverec['HDMF'] = $HDMF; $insertSQL = $conn2->GetInsertSQL($RsDeduction, $saverec); $conn2->Execute($insertSQL); } $sql = "SELECT EMP_NO, SSSLoan, HDMFLoan, UDTLoan FROM loan_deductions WHERE EMP_NO = '$empno'"; $RsLoan = $conn2->Execute($sql); $numrowsRsLoan = $RsLoan->RecordCount(); if($numrowsRsLoan > 0){ $saverec['EMP_NO'] = $empno; $saverec['SSSLoan'] = $SSSAmor; $saverec['HDMFLoan'] = $HDMFAmmor; $saverec['UDTLoan'] = $UDTAmor; $updateLoanSQL = $conn2->GetUpdateSQL($RsLoan, $saverec); $conn2->Execute($updateLoanSQL); } else{ $sql = "SELECT l.EMP_NO, l.SSSLoan, l.HDMFLoan, l.UDTLoan FROM $PAYROLL.loan_deductions l, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID'"; $RsLoan = $conn2->Execute($sql); $saverec['EMP_NO'] = $empno; $saverec['SSSLoan'] = $SSSAmor; $saverec['HDMFLoan'] = $HDMFAmor; $saverec['UDTLoan'] = $UDTAmor; $insertSQL = $conn2->GetInsertSQL($RsLoan, $saverec); $conn2->Execute($insertSQL); } $sql = "SELECT EMP_NO, Amount, TotalEarnings, TotalDeductions, TakeHomePay FROM totalpay WHERE EMP_NO = '$empno'"; $rsTotal = $conn2->Execute($sql); $numrows = $rsTotal->RecordCount(); if($numrows > 0){ $saverec['EMP_NO'] = $empno; $saverec['Amount'] = $Amount; $saverec['TotalEarnings'] = $TotEarn; $saverec['TotalDeductions'] = $TotalDed; $saverec['TakeHomePay'] = $THP; $updateSQL = $conn2->GetUpdateSQL($rsTotal, $saverec); $conn2->Execute($updateSQL); } else{ $sql = "SELECT t.EMP_NO, t.Amount, t.TotalEarnings, t.TotalDeductions, t.TakeHomePay FROM $PAYROLL.totalpay t, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID'"; $rsTotal = $conn2->Execute($sql); $saverec['EMP_NO'] = $empno; $saverec['Amount'] = $Amount; $saverec['TotalEarnings'] = $TotEarn; $saverec['TotalDeductions'] = $TotalDed; $saverec['TakeHomePay'] = $THP; $insertSQL = $conn2->GetInsertSQL($rsTotal, $saverec); $conn2->Execute($insertSQL); } $smarty->display('header.tpl'); $smarty->display('left.tpl'); $smarty->display('empPayrollData.tpl'); $smarty->display('footer.tpl'); ?> I have a problem in saving data from other deductions and the total deductions and takehomepay, because other deductions is insertable textfield and when I add other deductions the total deductions will change also the Take Home Pay. Idon't know where Can I add this code for saving data of other deductions and updating the changes if Total Deductions and Take Home Pay. Code: [Select] $sql = "SELECT EMP_NO, BurialSeparationCont, TaxAjt, CashAdvance, AdvanceShirt, AdvanceMed, AdvanceOther FROM other_deductions WHERE EMP_NO = '$empno'"; $rsOtherDed = $conn2->Execute($sql); $numrows1 = $rsOtherDed->RecordCount(); if($numrows1 > 0){ $saverec['EMP_NO'] = $empno; $saverec['BurialSeparationCont'] = $BurialSep; $saverec['TaxAjt'] = $TaxAjt; $saverec['CashAdvance'] = $CashAdvance; $saverec['AdvanceShirt'] = $AdvancesShirt; $saverec['AdvanceMed'] = $AdvancesMed; $saverec['AdvanceOther'] = $AdvancesOthers; $updateSQL = $conn2->GetUpdateSQL($rsOtherDed, $saverec); $conn2->Execute($updateSQL); } else{ $sql = "SELECT o.EMP_NO, o.BurialSeparationCont, o.TaxAjt, o.CashAdvance, o.AdvanceShirt, o.AdvanceMed, o.AdvanceOther FROM $PAYROLL.other_deductions o, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID'"; $rsOtherDed = $conn2->Execute($sql); $saverec['EMP_NO'] = $empno; $saverec['BurialSeparationCont'] = $BurialSep; $saverec['TaxAjt'] = $TaxAjt; $saverec['CashAdvance'] = $CashAdvance; $saverec['AdvanceShirt'] = $AdvancesShirt; $saverec['AdvanceMed'] = $AdvancesMed; $saverec['AdvanceOther'] = $AdvancesOthers; $insert = $conn2->GetInsertSQL($rsOtherDed, $saverec); $conn2->Execute($insert); } $Amount = $_POST["Amount"]; $TotEarn = $_POST["TotEarn"]; $TotalDed = $_POST["TotalDed"]; $THP = $_POST["TakeHomePay"]; $sql = "SELECT EMP_NO, Amount, TotalEarnings, TotalDeductions, TakeHomePay FROM totalpay WHERE EMP_NO = '$empno'"; $rsTotal = $conn2->Execute($sql); $numrows = $rsTotal->RecordCount(); if($numrows > 0){ $saverec['EMP_NO'] = $empno; $saverec['Amount'] = $Amount; $saverec['TotalEarnings'] = $TotEarn; $saverec['TotalDeductions'] = $TotalDed; $saverec['TakeHomePay'] = $THP; $updateSQL = $conn2->GetUpdateSQL($rsTotal, $saverec); $conn2->Execute($updateSQL); } else{ $sql = "SELECT t.EMP_NO, t.Amount, t.TotalEarnings, t.TotalDeductions, t.TakeHomePay FROM $PAYROLL.totalpay t, $ADODB_DB.employment em WHERE em.EMP_ID = '$currentEmpID'"; $rsTotal = $conn2->Execute($sql); $saverec['EMP_NO'] = $empno; $saverec['Amount'] = $Amount; $saverec['TotalEarnings'] = $TotEarn; $saverec['TotalDeductions'] = $TotalDed; $saverec['TakeHomePay'] = $THP; $insertSQL = $conn2->GetInsertSQL($rsTotal, $saverec); $conn2->Execute($insertSQL); } I don't know where I can put this code to save the data that i inserted in other deductions hy every one i have two files one is index.php and second insert.php as follow, index.php Code: [Select] <html> <body> <form action="insert.php" method="post"> Time <input type="text" name="time" /> <input type="submit" /> </form> <?php $ctime = date('h:i:s A'); echo "Current time is : " . $ctime ; echo "<br>"; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("time", $con); $result = mysql_query("SELECT * FROM time"); while($row = mysql_fetch_array($result)) { echo date('h:i:s A', strtotime($row['time'])); echo "<br />"; } mysql_close($con); ?> </body> </html> here is my insert.php file code, Code: [Select] <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("time", $con); $sql="INSERT INTO time (time ) VALUES ('$_POST[time]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; echo "<br>"; echo "<a href='index.php'>Home</a>"; mysql_close($con) ?> this code work fine but the form which submit the value of time in database whos code is in index.php file above, i have to enter time in the form text field like this 17:00 and it save the value in database but, i want to enter time in the form text field like this 05:00 PM which automatically save the value in database as 17:00 what should i do with the code help me please thanks Code: [Select] <html> <title>MyBB PM Exporter</title> <body> <form action ="<?php $_SERVER['PHP_SELF'] ?>" method="post"> URL to site: <input type ="text" name="site" value='community.mybb.com' /><br> Full path to user:pwd list: <input type ="text" name="path" value='/home/www/list.txt' /><br> <input type = "submit" value="Export" /> </form> </body> </html> <?php if(isset($_POST['path']) && isset($_POST['site'])) { $list = $_POST['path']; $url = $_POST['site']; $file = file($list); foreach($file as $line){ $explode = explode(":",$line); $username = $explode[0]; $password = $explode[1]; $crl = curl_init(); curl_setopt($crl, CURLOPT_URL, $url."/member.php"); curl_setopt($crl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt"); curl_setopt($crl, CURLOPT_COOKIEJAR, "/tmp/cookie.txt"); curl_setopt($crl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($crl, CURLOPT_POST, 1); // This array will hold the field names and values. $postdata=array( "username"=>"$username", "password"=>"$password", "remember"=>"no", "submit"=>"Login", "action"=>"do_login", "url"=>$url."/member.php" ); // Tell curl we're going to send $postdata as the POST data curl_setopt ($crl, CURLOPT_POSTFIELDS, $postdata); $result=curl_exec($crl); $find_key = preg_match('/var my_post_key = "(.*?)"/',$result,$match); $my_post_key = $match[1]; curl_setopt($crl, CURLOPT_URL, $url."/private.php"); curl_setopt($crl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($crl, CURLOPT_POST, 1); // This array will hold the field names and values. $postdata=array( "my_post_key" => $my_post_key, "exportfolders[]" => "all", "dayway" => "disregard", "exportunread" => "1", "deletepms" => "0", "exporttype" => "html", "action" => "do_export", "submit" => "Export Private Messages" ); curl_setopt ($crl, CURLOPT_POSTFIELDS, $postdata); $fh = fopen($username.".html", 'w'); curl_setopt($crl, CURLOPT_FILE, $fh); curl_exec($crl); fclose($fh); curl_close($crl); } } ?> So , basically this code just opens the file where username:password is located and then it logins to community.mybb.com with each combination in that file and saves the content of pm's of logged in user. Problem is that this script allways saves pm's of only one user and it saves other usernames pm's but with the same content of the first user. Hi.. I need to save data from a while loop and data from select option, Now I encountered that using my query I only save is the last part of my while loop and also the data that I choose in select option did not save. here is my code: Code: [Select] <?php error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $sr_date =date('Y-m-d H:i:s'); $sr_date = $_POST['sr_date']; $sr_number = $_POST['sr_number']; $Items = $_POST['Items']; $SubItems = $_POST['SubItems']; $ItemCode = $_POST['ItemCode']; $DemandedQty = $_POST['DemandedQty']; $UoM = $_POST['UoM']; $Class = $_POST['Class']; $Description = $_POST['Description']; $BINLocation = $_POST['BINLocation']; $RequestedBy = $_POST['RequestedBy']; $ApprovedBy = $_POST['ApprovedBy']; $ReceivedBy = $_POST['ReceivedBy']; $IssuedBy = $_POST['IssuedBy']; $sql = "INSERT INTO stock_requisition (sr_date, sr_number, Items, SubItems, ItemCode, DemandedQty, UoM, Class, Description, BINLocation, RequestedBy, ApprovedBy, ReceivedBy, IssuedBy) VALUES ('$sr_date', '$sr_number', '$Items', '$SubItems', '$ItemCode', '$DemandedQty', '$UoM', '$Class', '$Description', '$BINLocation', '$RequestedBy', '$ApprovedBy', '$ReceivedBy', '$IssuedBy') ON DUPLICATE KEY UPDATE sr_date = '$sr_date', sr_number = '$sr_number', Items = '$Items', SubItems = '$SubItems', ItemCode = '$ItemCode', DemandedQty = '$DemandedQty', UoM = '$UoM', Class = '$Class', Description = '$Description', BINLocation = '$BINLocation', RequestedBy = '$RequestedBy', ApprovedBy = '$ApprovedBy', ReceivedBy = '$ReceivedBy', IssuedBy = '$IssuedBy'"; $result = mysql_query($sql, $con); $sql = "SELECT sr_number FROM stock_requisition ORDER BY sr_date DESC LIMIT 1"; $result = mysql_query($sql, $con); if (!$result) { echo 'failed'; die(); } $total = mysql_num_rows($result); if ($total <= 0) { $currentSRNum = 1; } else { //------------------------------------------------------------------------------------------------------------------ // Stock Number iteration.... $row = mysql_fetch_assoc($result); $currentSRNum = (int)(substr($row['sr_number'],0,3)); $currentSRYear = (int)(substr($row['sr_number'],2,2)); $currentSRMonth = (int)(substr($row['sr_number'],0,2)); $currentSRNum = (int)(substr($row['sr_number'],6,4)); $currentYear = (int)(date('y')); $currentMonth = (int)(date('m')); $currentDay = (int)(date('d')); $currentSRYMD = substr($row['sr_number'], 0, 6); $currentYMD = date("ymd"); if ($currentYMD > $currentSRYMD) { $currentSRNum = 1; } else { $currentSRNum += 1; } } //------------------------------------------------------------------------------------------------------------------ $yearMonth = date('ymd'); $currentSR = $currentYMD . sprintf("%04d", $currentSRNum); ?> <html> <title>Stock Requisition</title> <head> <style type="text/css"> #ddcolortabs{ margin-left: 2px; padding: 0; width: 100%; background: transparent; voice-family: "\"}\""; voice-family: inherit; padding-left: 2px; } #ddcolortabs ul{ font: bold 12px Arial, Verdana, sans-serif; margin:0; padding:0; list-style:none; } #ddcolortabs li{ display:inline; margin:0 2px 0 0; padding:0; text-transform:uppercase; } #ddcolortabs a{ float:left; color: white; background: #8cb85c url(layout_image/color_tabs_left.gif) no-repeat left top; margin:2px 2px 0 0; padding:0px 0 1px 3px; text-decoration:none; letter-spacing: 1px; } #ddcolortabs a span{ float:right; display:block; /*background: transparent url(layout_image/color_tabs_right.gif) no-repeat right top;*/ padding:6px 9px 2px 6px; } #ddcolortabs a span{ float:none; } #ddcolortabs a:hover{ background-color: #678b3f; } #ddcolortabs a:hover span{ background-color: #678b3f ; } #ddcolortabs #current a, #ddcolortabs #current span{ /*currently selected tab*/ background-color: #678b3f; } </style> <style type="text/css"> #ddcolortabs1{ position: relative; top: 10px; margin-left: 2px; padding: 0; width: 100%; background: transparent; voice-family: "\"}\""; voice-family: inherit; padding-left: 2px; } #ddcolortabs1 ul{ font: bold 12px Arial, Verdana, sans-serif; margin:0; padding:0; list-style:none; } #ddcolortabs1 li{ display:inline; margin:0 2px 0 0; padding:0; text-transform:uppercase; } #ddcolortabs1 a{ float:left; color: white; background: #8cb85c url(layout_image/color_tabs_left.gif) no-repeat left top; margin:2px 2px 0 0; padding:0px 0 1px 3px; text-decoration:none; letter-spacing: 1px; } #ddcolortabs1 a span{ float:right; display:block; /*background: transparent url(layout_image/color_tabs_right.gif) no-repeat right top;*/ padding:6px 9px 2px 6px; } #ddcolortabs1 a span{ float:none; } #ddcolortabs1 a:hover{ background-color: #678b3f; } #ddcolortabs1 a:hover span{ background-color: #678b3f ; } #ddcolortabs1 #current a, #ddcolortabs1 #current span{ /*currently selected tab*/ background-color: #678b3f; } </style> <style> #SR_date{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .9em; margin-left: 10px; width: auto; height: auto; float: left; top : 10px; } #SR_number{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .9em; margin-left: 270px; width: auto; height: auto; float: left; top : 10px; } table { margin: 10px; font-family: Arial, Helvetica, sans-serif; font-size: .9em; border: 1px solid #DDD; width: auto; } th { font-family: Arial, Helvetica, sans-serif; font-size: .7em; background: #694; color: #FFF; padding: 2px 6px; border-collapse: separate; border: 1px solid #000; } td { font-family: Arial, Helvetica, sans-serif; font-size: .7em; border: 1px solid #DDD; text-align: left; } #RequestedBy{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .8em; margin-left: 10px; width: auto; height: auto; float: left; top : 10px; } #ApprovedBy{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .8em; margin-left: 15px; width: auto; height: auto; float: left; top : 10px; } #ReceivedBy{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .8em; margin-left: 15px; width: auto; height: auto; float: left; top : 10px; } #IssuedBy{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .8em; margin-left: 15px; width: auto; height: auto; float: left; top : 10px; margin-right: 120px; } #save_btn{ position: relative;; font-family: Arial, Helvetica, sans-serif; font-size: .8em; margin-left: 10px; top: 10px; } </style> <script type="text/javascript"> function save_sr(){ var sr_date = document.getElementById("sr_date").value; var sr_number = document.getElementById("sr_number").value; var Items = document.getElementById("Items").value; var SubItems = document.getElementById("SubItems").value; var ItemCode = document.getElementById("ItemCode").value; var DemandedQty = document.getElementById("DemandedQty").value; var UoM = document.getElementById("UoM").value; var Class = document.getElementById("Class").value; var Description = document.getElementById("Description").value; var BINLocation = document.getElementById("BINLocation").value; var RequestedBy = document.getElementById("RequestedBy").value; var ApprovedBy = document.getElementById("ApprovedBy").value; var ReceivedBy = document.getElementById("ReceivedBy").value; var IssuedBy = document.getElementById("IssuedBy").value; document.stock_requisition.action="StockRequisitionSave.php?sr_date="+sr_date+"&sr_number="+sr_number+"&Items="+Items+ "&SubItems="+SubItems+"&ItemCode="+ItemCode+"&DemandedQty="+DemandedQty+"&UoM="+UoM+"&Class="+Class+"&Description="+ Description+"&BINLocation="+BINLocation+"&RequestedBy="+RequestedBy+"&ApprovedBy="+ApprovedBy+"&ReceivedBy="+ReceivedBy+ "&IssuedBy="+IssuedBy; document.stock_requisition.submit(); alert("Stock Requisition data save."); window.location = "StockRequisition.php"; } </script> </head> <body> <form name="stock_requisition" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <div id="ddcolortabs"> <ul> <li> <a href="ParameterSettings.php" title="Parameter Settings"><span>Parameter Settings</span></a></li> <li style="margin-left: 1px"><a href="kanban_report.php" title="WIP Report"><span>Wip Report</span></a></li> <li id="current"><a href="StockRequisition.php" title="WMS RM"><span>WMS RM</span></a></li> </ul> </div> <div id="ddcolortabs1"> <ul> <li><a href="ReceivingMaterials.php" title="Receiving Materials"><span>Receiving Materials</span></a></li> <li><a href="Shelving.php" title="Shelving"><span>Shelving</span></a></li> <li id="current"><a href="StockRequisition.php" title="Stock Requisition"><span>Stock Requisition</span></a></li> </ul> </div> <div id="SR_date"> <label>Date :</label> <input type="text" name="sr_date" value="<?php echo $sr_date; ?>" size="16" readonly="readonly" style="border: none;"> </div> <div id="SR_number"> <label>SR# :</label> <input type="text" name="sr_number" value="<?php echo $currentSR; ?>" size="10" readonly="readonly" style="font-weight: bold; border: none;"> <br/> </div> <div> <table> <thead> <th>Items</th> <th>Sub Items</th> <th>Item Code</th> <th>Demanded Qty</th> <th>UoM</th> <th>Class</th> <th>Description</th> <th>BIN Location</th> </thead> <?php $sql = "SELECT DISTINCT Items FROM bom_subitems ORDER BY Items"; $res_bom = mysql_query($sql, $con); while($row = mysql_fetch_assoc($res_bom)){ $Items = $row['Items']; echo "<tr> <td style='border: none;font-weight: bold;'> <input type='name' value='$row[Items]' name='Items' id='Items' readonly = 'readonly' style = 'border:none;width:auto;font-family: Arial, Helvetica, sans-serif;font-size: 1em;' size='5'></td> </tr>"; $sql = "SELECT SubItems, ItemCode, UoM, Class, Description, BINLocation FROM bom_subitems WHERE Items = '$row[Items]' ORDER BY Items"or die(mysql_error()); $res_sub = mysql_query($sql, $con); while($row_sub = mysql_fetch_assoc($res_sub)){ echo "<tr> <td style='border: none;'> </td> <td style='border: none;'> <input type='text' name='SubItems' value='$row_sub[SubItems]' id='SubItems' readonly='readonly' style='border:none; width:auto;font-family: Arial, Helvetica, sans-serif;font-size: 1em;' size='10'></td> <td style='border: none;'> <input type='text' name='ItemCode' value='$row_sub[ItemCode]' id='ItemCode' readonly='readonly' style='border:none; width:auto;font-family: Arial, Helvetica, sans-serif;font-size: 1em;' size='10'></td> <td style='border: none;'><center><input type='text' name='DemandedQty' id='DemandedQty' value='' size='7'></center></td> <td style='border: none;' size='3'> <input type='text' name='UoM' value='$row_sub[UoM]' id='UoM' readonly='readonly' style='border:none; width:auto;font-family: Arial, Helvetica, sans-serif;font-size: 1em;' size='3'></td> <td style='border: none;'> <input type='text' name='Class' value='$row_sub[Class]' id='Class' readonly='readonly' style='border:none; width:auto;font-family: Arial, Helvetica, sans-serif;font-size: 1em;' size='10'></td> <td style='border: none;'> <input type='text' name='Description' value='$row_sub[Description]' id='Description' readonly='readonly' style='border:none; width:auto;font-family: Arial, Helvetica, sans-serif;font-size: 1em;' size='10'></td> <td style='border: none;'> <input type='text' name='BINLocation' value='$row_sub[BINLocation]' id='BINLocation' readonly='readonly' style='border:none; width:auto;font-family: Arial, Helvetica, sans-serif;font-size: 1em;' size='10'></td> </tr>"; } } ?> </table> </div> <div id='RequestedBy'> <label>Requested By:</label> <select name="Requested_By"> <option name='None'>Select</option> <option name='AAAAAAAAA'>AAAAAAAAA</option> <option name='BBBBBBBBB'>BBBBBBBBB</option> <option name='CCCCCCCCCC'>CCCCCCCCCC</option> </select> </div> <div id='ApprovedBy'> <label>Approved By:</label> <select name="Approved_By"> <option name='None'>Select</option> <option name='AAAAAAAAA'>AAAAAAAAA</option> <option name='BBBBBBBBB'>BBBBBBBBB</option> <option name='CCCCCCCCCC'>CCCCCCCCCC</option> </select> </div> <div id='ReceivedBy'> <label>Received By:</label> <select name="Received_By"> <option name='None'>Select</option> <option name='AAAAAAAAA'>AAAAAAAAA</option> <option name='BBBBBBBB'>BBBBBBBB</option> <option name='CCCCCCCC'>CCCCCCCC</option> </select> </div> <div id='IssuedBy'> <label>Issued By:</label> <select name="Issued BY"> <option name='None'>Select</option> <option name='AAAAAAAAA'>AAAAAAAAA</option> <option name='BBBBBBBB'>BBBBBBBB</option> <option name='CCCCCCCC'>CCCCCCCC</option> </select> </div> <div id="save_btn"> <input type="button" name="button" value="save" onclick="save_sr()"> </div> </body> </html> I also I attach the display data. Thank you I guys, i´m seting up a template from themeforest for a customer, and i got to change the charset of the pages, it seems that everything was working, but to my surprise the text inside the h1 tags did not accepted the latin caracters, i`ve tryed everything but they still not changed, can you give me a hand?
Hi How can I make the data in phpmyadmin accept Arabic Language. Now Arabic language shows as question markss ?????????????. Is there anyway to do this via php? I searched online and seen some complex c and c# code which I didn't understand much of. But how do I generate an array with all string combinations based on length and from a charset? E.g. charset = {'a', 'b', 'c'} Length = 2. Then it should generate first all 1-char strings: a b c Then all 2-char strings: aa ab ac ba bb bc ca cb cc And then all added to the same array. I think there's some way of doing it with recursion but to me it's like thinking with a 4th dimension my mind can't grasp this logic! i have made 2 classes. the first "point" has an array of 3 floats and some functions to help manipulate the values the second "triangle" has an array of 3 points. in this way if i want to make a tetrahedron i can make 4 points and assign them to 4 triangles. problem is for some reason each triangle point group seems to use 1k. any idea why? I have a .php code that gets data from a database and saves it in a variables as xml. However how can I then save all of the data in this variable as a .xml file somewhere? Thanks for any help. Am trying to update a table called "budget_request" and also inserting the data of that table into another table called "Budget". The Update works but it is not inserting into the other table. please help me out.. check my code below
<?php $id = $_GET['id']; ?> <?php include('mysql_connect.php'); $q = mysql_query("UPDATE budget_request SET status = 'Approved' WHERE id = '$id'") or die(mysql_error()); // send the details to the budget database $query = mysql_query("SELECT * FROM budget_request WHERE id = '$id' ") or die (mysql_error()); $dat = mysql_fetch_array($query); $department = $dat['department']; $amount = $dat['amount']; // Add the data to the Budget DB $que = (" INSERT INTO budget (id, department, amount, actual) VALUES ( ' ','$department', '$amount', '$amount')" ) or die(mysql_error()); header("Location: add_budget.php"); ?> I have problem how to saving all my record.
when I save I just got 1 record saved in mySQL and it the last record on that table. Here is my code =
<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO thasil (nrp, nama, pangkat, mgolongan, mtes_fisik, mkemampuan, hasil) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['nrp'], "int"), GetSQLValueString($_POST['nama'], "text"), GetSQLValueString($_POST['pangkat'], "text"), GetSQLValueString($_POST['mgolongan'], "int"), GetSQLValueString($_POST['mtes_fisik'], "double"), GetSQLValueString($_POST['mkemampuan'], "double"), GetSQLValueString($_POST['hasil'], "double")); mysql_select_db($database_stok, $stok); $Result1 = mysql_query($insertSQL, $stok) or die(mysql_error()); $insertGoTo = ""; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_stok, $stok); $query_anggotaset = "SELECT * FROM tanggota ORDER BY nrp ASC"; $anggotaset = mysql_query($query_anggotaset, $stok) or die(mysql_error()); $row_anggotaset = mysql_fetch_assoc($anggotaset); $totalRows_anggotaset = mysql_num_rows($anggotaset); mysql_select_db($database_stok, $stok); $query_bobotset = "SELECT * FROM tbobot"; $bobotset = mysql_query($query_bobotset, $stok) or die(mysql_error()); $row_bobotset = mysql_fetch_assoc($bobotset); $totalRows_bobotset = mysql_num_rows($bobotset); $crMax = mysql_query("SELECT min(Golongan) as minK1, max(tes_fisik) as maxK2, max(kemampuan) as maxK3 FROM tanggota"); $max = mysql_fetch_array($crMax); $no=1; ?> <?php include ('header.php') ?> <div id="conten-wrapper"> <div id="conten"> <h1> Normalisasi Anggota Kesamaptaan </h1> <p> <a href="cetak.php"><img src="../images/btn_list.png" height="20"/> >>> Lihat & Cetak Hasil Akhir Perangkingan</a></p> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table border="1" cellpadding="3" cellspacing="1"> <tr> <td>no</td> <td>nrp</td> <td>nama</td> <td>pangkat</td> <td>C1 Golongan</td> <td>C2 tes_fisik</td> <td>C3 kemampuan</td> <td>hasil</td> </tr> <?php do { $hasil= round (($max['minK1']/$row_anggotaset['Golongan']*$row_bobotset['golongan']+ $row_anggotaset['tes_fisik']/$max['maxK2']*$row_bobotset['tes_fisik']+ $row_anggotaset['kemampuan']/$max['maxK3']*$row_bobotset['kemampuan']),2) ; ?> <tr> <td><?php echo $no; $no++;?></td> <td><input type="text" name="nrp" value="<?php echo $row_anggotaset['nrp']; ?>" readonly/></td> <td><input type="text" name="nama" value="<?php echo $row_anggotaset['nama']; ?>" readonly/></td> <td><input type="text" name="pangkat" value="<?php echo $row_anggotaset['pangkat']; ?>" size="4" readonly/></td> <td><input type="text" name="mgolongan" value="<?php echo round ($max['minK1']/$row_anggotaset['Golongan'] *$row_bobotset['golongan'],2); ?>" size="2" readonly/></td> <td><input type="text" name="mtes_fisik" value="<?php echo round ($row_anggotaset['tes_fisik']/$max['maxK2'] *$row_bobotset['tes_fisik'],2); ?>" size="2" readonly/></td> <td><input type="text" name="mkemampuan" value="<?php echo round ($row_anggotaset['kemampuan']/$max['maxK3'] *$row_bobotset['kemampuan'],2); ?>" size="3" readonly/></td> <td><input type="text" name="hasil" value="<?php echo $hasil ?>" size="2" readonly/></td> </tr> <?php } while ($row_anggotaset = mysql_fetch_assoc($anggotaset));?> <tr valign="baseline"> <td colspan="8" align="right" nowrap="nowrap"><input type="submit" value="Insert record" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> </div> <?php include ('footer.php') ?> </body> </html> <?php mysql_free_result($anggotaset); mysql_free_result($bobotset); ?> $new_relation->save(); echo "after save".$requestor_profile->getId()." ".$requestee_profile->getId(); return true; }catch(PropelException $e) { echo "in die"; die($e); return false; } }//end - if (!$res) [/PHP] the echo after the save executes but when i look in my db table there is nothing???? please help??? Hi, I'm completely new to anything that is not html but I'm wondering if in something like php I can get a checkbox to permanently save through reloads and different machines. My idea was just to have a page with only a checkbox on it, and then load that through and iframe in html. If anybody could give me the code for that checkbox page (complete if possible as I don't really know anything about that type of programming) I would be very grateful. Thank You I'm trying to get an equation from a user that types it in the url, ex) 1+2+3. I can get the 1,2,3 fine, but the + operator is no longer in the string. Same with the * and / operators. Is there a way to keep them as a string using $_GET?
|