Jump to content

Senthilkumar

Members
  • Posts

    184
  • Joined

  • Last visited

Everything posted by Senthilkumar

  1. Dear Barand, I am trying this bellow subquery select Category,sum(Quantity) as Actual from dbms.tiv_data WHERE Brand='XCMG' AND Category = (select Category, sum(Total) as Target from dbms.currentyeardata WHERE Dealerid = '81019218' group by Category); But i am getting error "Error Code: 1241. Operand should contain 1 column(s)"
  2. Dear Barand, when i am running select * from query on tiv_data it returns total 11 rows When i am running select * from query on currentyear data it returns total 20 rows When i am running the inner join query as per your suggession i am getting total 90 row Because of this the sum value is updating wrong. Can you please suggest me what to do for this problem
  3. Dear Team, I am having a table which is displaying actual and target values from two different mysql table. My table is In above table when i am selecting the month the actual and target date should display from the databse. When i am using the bellow code all the target value is displaying <script>//..................month hide function function myFunction() { var month = document.getElementById("month").value; var dealerid = document.getElementById("dealerid").value; $.ajax({ type: 'POST', dataType: 'JSON', url: 'Revenue_Data.php', data: 'month=' + month + '&dealerid=' + dealerid, //data: 'month=' + month + '&dealerid=' + dealerid, success: function (response) { //var jsonData = JSON.parse(response); var len = response.length; //alert(jsonData); for (var i = 0; i < len; i++) { var Category_Name = response[i].Category_Name; var Description = response[i].Description; var Month_Value = response[i].Month_Value; var result = response[i].result; //var Excavator = response[i].Excavator; //var Grader = response[i].Grader; //var WheelLoader = response[i].WheelLoader; //var SLM = response[i].SLM; //var Parts_Service_ID = response[i].Parts_Service_ID; //var Revanue = response[i].Revanue; //var Margin = response[i].Margin; document.getElementById(result).value = Month_Value; //document.getElementById('ExcavatorActual'+Parts_Service_ID).value = Excavator; //document.getElementById('GraderActual'+Parts_Service_ID).value = Grader; //document.getElementById('WheelLoaderActual'+Parts_Service_ID).value = WheelLoader; //document.getElementById('SLMActual'+Parts_Service_ID).value = SLM; //document.getElementById('RevenueActual'+Parts_Service_ID).value = Revanue; //document.getElementById('Margin'+Parts_Service_ID).value = Margin; } } }); } </script> <?php // Include the database config file include("../connection.php"); //error_reporting(0); error_reporting(E_ALL); ini_set('display_errors', '1'); //ini_set('display_errors','Off'); if(!empty($_POST["month"]) ){ $Month=$_POST["month"]; $dealerid = $_POST["dealerid"]; $Mon = date('M', strtotime($Month)); $sql = "select $Mon,Category_Name,Description from revenuetarget WHERE Dealer_ID = '$dealerid'"; $result = mysqli_query($conn, $sql); while ($row = mysqli_fetch_array($result)) { $Category_Name = $row['Category_Name']; $Description = $row['Description']; $Month_Value = $row[$Mon]; $Description1= str_replace(' ', '', $Description); $Category_Name1= str_replace(' ', '', $Category_Name); $result1 = trim($Category_Name1); $result1 .= trim($Description1); $return_arr[] = array( "Category_Name" => $Category_Name, "Description" => $Description, "result" => $result1, "Month_Value" => $Month_Value, ); } $sql = "select * from revenue_data WHERE dealerid = '$dealerid' AND month = '$Month'"; $result = mysqli_query($conn, $sql); while ($row = mysqli_fetch_array($result)) { $Excavator = $row['Excavator']; $Grader= $row['Grader']; $WheelLoader = $row['WheelLoader']; $SLM = $row['SLM']; $Parts_Service_ID = $row['Parts_Service_ID']; $Revanue = $row['Revanue']; $Margin = $row['Margin']; $return_arr1[] = array( "Excavator" => $Excavator, "Grader" => $Grader, "WheelLoader" => $WheelLoader, "SLM" => $SLM, "Parts_Service_ID" => $Parts_Service_ID, "Revanue" => $Revanue, "Margin" => $Margin, ); } echo json_encode($return_arr); //echo json_encode($return_arr1); } ?> When i am using the bellow code all my actual values are displaying <script>//..................month hide function function myFunction() { var month = document.getElementById("month").value; var dealerid = document.getElementById("dealerid").value; $.ajax({ type: 'POST', dataType: 'JSON', url: 'Revenue_Data.php', data: 'month=' + month + '&dealerid=' + dealerid, //data: 'month=' + month + '&dealerid=' + dealerid, success: function (response) { //var jsonData = JSON.parse(response); var len = response.length; //alert(jsonData); for (var i = 0; i < len; i++) { //var Category_Name = response[i].Category_Name; //var Description = response[i].Description; //var Month_Value = response[i].Month_Value; //var result = response[i].result; var Excavator = response[i].Excavator; var Grader = response[i].Grader; var WheelLoader = response[i].WheelLoader; var SLM = response[i].SLM; var Parts_Service_ID = response[i].Parts_Service_ID; var Revanue = response[i].Revanue; var Margin = response[i].Margin; //document.getElementById(result).value = Month_Value; document.getElementById('ExcavatorActual'+Parts_Service_ID).value = Excavator; document.getElementById('GraderActual'+Parts_Service_ID).value = Grader; document.getElementById('WheelLoaderActual'+Parts_Service_ID).value = WheelLoader; document.getElementById('SLMActual'+Parts_Service_ID).value = SLM; document.getElementById('RevenueActual'+Parts_Service_ID).value = Revanue; document.getElementById('Margin'+Parts_Service_ID).value = Margin; } } }); } </script> <?php // Include the database config file include("../connection.php"); //error_reporting(0); error_reporting(E_ALL); ini_set('display_errors', '1'); //ini_set('display_errors','Off'); if(!empty($_POST["month"]) ){ $Month=$_POST["month"]; $dealerid = $_POST["dealerid"]; $Mon = date('M', strtotime($Month)); $sql = "select $Mon,Category_Name,Description from revenuetarget WHERE Dealer_ID = '$dealerid'"; $result = mysqli_query($conn, $sql); while ($row = mysqli_fetch_array($result)) { $Category_Name = $row['Category_Name']; $Description = $row['Description']; $Month_Value = $row[$Mon]; $Description1= str_replace(' ', '', $Description); $Category_Name1= str_replace(' ', '', $Category_Name); $result1 = trim($Category_Name1); $result1 .= trim($Description1); $return_arr[] = array( "Category_Name" => $Category_Name, "Description" => $Description, "result" => $result1, "Month_Value" => $Month_Value, ); } $sql = "select * from revenue_data WHERE dealerid = '$dealerid' AND month = '$Month'"; $result = mysqli_query($conn, $sql); while ($row = mysqli_fetch_array($result)) { $Excavator = $row['Excavator']; $Grader= $row['Grader']; $WheelLoader = $row['WheelLoader']; $SLM = $row['SLM']; $Parts_Service_ID = $row['Parts_Service_ID']; $Revanue = $row['Revanue']; $Margin = $row['Margin']; $return_arr1[] = array( "Excavator" => $Excavator, "Grader" => $Grader, "WheelLoader" => $WheelLoader, "SLM" => $SLM, "Parts_Service_ID" => $Parts_Service_ID, "Revanue" => $Revanue, "Margin" => $Margin, ); } //echo json_encode($return_arr); echo json_encode($return_arr1); } ?> I want to display botht the values (Actual and target) on same time. How can i get two array values on same time and display on the table.
  4. Dear Team, I am creating google pie chart from mysql database on my PHP project. My actual chart and output is <script type="text/javascript"> google.charts.load("current", {packages:["corechart"]}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['class Name','Students'], <?php $query = "select Brand, SUM(ASP) as sum from dbms.tiv_data where Category ='EXCAVATOR' AND Dealerid = '$Emp_No' group by Brand order by sum DESC"; $exec = mysqli_query($conn, $query); while ($row = mysqli_fetch_array($exec)) { $Brand = $row['Brand']; $ASP = $row['sum']; echo "['$Brand',$ASP],"; } ?> ]); var options = { is3D: true, }; var chart = new google.visualization.PieChart(document.getElementById('Excavator_MS')); chart.draw(data, options); } </script> <div class="row " style="width:100%;margin-left:5px"> <div class="column card" style="width:33.33%;text-align:center"> <label style="text-align:center">Excavator</label> <div id="Excavator_MS" style="width: 100%; height: 200px;" onclick="Excavator()"></div> </div> </div> But i want the filter option should be placed on the graph My database is like bellow I want once i select the month the chart data should change without refresh the page. Can any one help me how to do this
  5. Dear Team, I am having two different tables dbms.tiv_data & dbms.currentyeardata. Wheni am using sum function on bothe the tabel seperatly, it is working fine select Category,sum(Quantity) as Actual from dbms.tiv_data WHERE Brand='XCMG' group by Category the output is select Category, sum(Total) as Target from dbms.currentyeardata group by Category The output is But wheni am using inner join query , i am getting wrong output SELECT dbms.tiv_data.Category, sum(dbms.tiv_data.Quantity) AS Actual,sum(dbms.currentyeardata.Total) AS Target from dbms.currentyeardata Inner join dbms.tiv_data ON dbms.tiv_data.Dealerid = dbms.currentyeardata.Dealer_ID WHERE dbms.tiv_data.Dealerid = '81019218' AND dbms.tiv_data.Brand = 'XCMG' group by dbms.tiv_data.Category order by Actual ASC THe worng output is Can any one please correct where i am doing mistake on this query
  6. Dear Barand, Thanks for your reply. It is the problem of space on the the ID name. Now i removed the space on Category and Description using the bellow code $Description = str_replace(' ', '', $row['Description']); Now all the target values are updating properly Once again thank you team for supporting me to complete this.
  7. Dear Team, Waiting for your support. Please help me
  8. Dear mac_gyver, as per your guidness I have included the Category name and Description on table column ID. My table <tr> code is <tr> <td align='center'> <?php echo $n++ ?> </td> <td style="text-align:center"> <?php echo $row['Department']; ?> </td> <td hidden> <input type="text" name="Department[]" id="Department" value=" <?php echo $row['Department']; ?> " style="width:100px" readonly /> </td> <td> <?php echo $row['Description']; ?> </td> <td hidden> <input type="text" name="Description[]" id='Description' value=" <?php echo $row['Description']; ?> " style="width:100px" readonly /> </td> <td style="text-align:center" hidden> <?php echo $row['Indicative_Margin']; ?> </td> <td hidden> <input type="text" name="Indicative_Margin[]" id="Indicative_Margin" class="Indicative_Margin" value=" <?php echo $row['Indicative_Margin']; ?> " style="width:100px" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control ExcavatorTarget " name="ExcavatorTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id=" EXCAVATOR<?php echo $row['Description']; ?>" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control ExcavatorActual calc" name="ExcavatorActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control GraderTarget " name="GraderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GRADER<?php echo $row['Description']; ?>" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control GraderActual calc" name="GraderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control WheelLoaderTarget " name="WheelLoaderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id=" WHEELLOADER<?php echo $row['Description']; ?>" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control WheelLoaderActual calc" name="WheelLoaderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control SLMTarget " name="SLMTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id=" SLM<?php echo $row['Description']; ?>" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control SLMActual calc" name="SLMActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control RevenueTarget " name="RevenueTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="RevenueTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control RevenueActual" name="RevenueActual[]" id="RevenueActual" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" value="" style="width:100%" readonly /> </td> <td style="width:200px" > <input type="number" name="Margin[]" class="form-control Margin" id="Margin" value="" style="width:100%" readonly autocomplete="off" /> </td> <td hidden align='center' style="width:10%"> <input type="checkbox" checked="checked" class="checkbox" name='lang[]' value="1" /> </td> </tr> Then i am fetching values from the php. My php code is <?php // Include the database config file include("../connection.php"); //error_reporting(0); error_reporting(E_ALL); ini_set('display_errors', '1'); //ini_set('display_errors','Off'); if(!empty($_POST["month"]) ){ $Month=$_POST["month"]; $dealerid = $_POST["dealerid"]; $Mon = date('M', strtotime($Month)); //$Category_Name = $_POST["Category_Name"]; // $Description = $_POST["Description"]; $sql = "select $Mon,Category_Name,Description from revenuetarget WHERE Dealer_ID = '$dealerid'"; $result = mysqli_query($conn, $sql); while ($row = mysqli_fetch_array($result)) { $Category_Name = $row['Category_Name']; $Description = $row['Description']; $Month_Value = $row[$Mon]; $return_arr[] = array( "Category_Name" => $Category_Name, "Description" => $Description, "Month_Value" => $Month_Value, ); } echo json_encode($return_arr); } ?> Then i am setting the values on the column id using ajax. Ajax code is <script>//..................month hide function function myFunction() { var key = $(this).attr('data-key'); var month = document.getElementById("month").value; var dealerid = document.getElementById("dealerid").value; //var Description = document.getElementById("Description").value; // var Description = $("#Description").val(); $.ajax({ type: 'POST', dataType: 'JSON', url: 'Revenue_Data.php', data: 'month=' + month + '&dealerid=' + dealerid, //data: 'month=' + month + '&dealerid=' + dealerid, success: function (response) { var len = response.length; for (var i = 0; i < len; i++) { var Category_Name = response[i].Category_Name; var Description = response[i].Description; var Month_Value = response[i].Month_Value; // document.getElementById("WheelLoaderTarget").value = Month_Value; document.getElementById(Category_Name + Description).value = Month_Value; } } }); } </script> But the value is not appending on the table. Can you please check and confirm the mistake
  9. I am setting the target for all my descriptions monthly wise to my all dealers. The dealer will enter the actual vaues monthly wise and submit the form. So when the dealer is selecting the month, he wants to know what is his target for the description on that particular selected month. This is the concept of these page.
  10. Dear mac I am just learning the php code with help of experts like you and I never used Indexed/ Pivoted data in loop and dont have idea on this. please help me
  11. Dear Mr.mac_gyver, I had changed the code litelbit as per your suggession. The output of the table is In this table the Deparment and Description will update fro the table "parts_service" based on the moth selection and the target values will display from the table "revenuetarget" The modified table code is <form method="POST" action="" onsubmit="return confirm('Are you sure you want to submit?');"> <div style="display: inline-block"> Select Month:<input type="month" name="month" class="month" id="month" onchange="myFunction()" placeholder="Select Month" required value="" style="width:auto;border:solid; border-color:black;font-family:Cambria;border-radius:5px;height:30px;margin-bottom:10px" /> </div> <div style="display: inline-block"> <input type="text" hidden name="dealerid" class="dealerid" id="dealerid" value="<?PHP echo $Emp_No ?>" style="width:100px" /> </div> <?PHP $col = ['Excavator', 'Grader', 'Wheel Loader', 'SLM', 'Revenue']; $target_txt = 'Target in lakh'; $actual_txt = 'Actual in lakh'; ?> <div class="tbl_fixed"> <table> <thead> <tr> <th style="width:5%;">S.no</th> <th style="width:10%;">Department</th> <th style="width:25%;">Description</th> <?php foreach($col as $c) { echo "<th style='width:6%;'>$c $target_txt</th>"; echo "<th style='width:6%;'>$c $actual_txt</th>"; } ?> </tr> </thead> <tbody> <?php // $qry=mysqli_query($conn,"SELECT * FROM users where Approver1_Name = '$Name' OR Approver2_Name = '$Name' "); $qry=mysqli_query($conn,"SELECT * FROM parts_service "); $n = 1; //while($row = $qry->fetch_assoc()){ //$Description = $row['Description']; //$Department = $row['Department']; // $Indicative_Margin = $row['Indicative_Margin']; $data = []; foreach ($qry as $row) { $data[$row['Description']][$row['Category_Name']] = $row; //} //print_r($data); ?> <tr> <td align='center'> <?php echo $n++ ?> </td> <td style="text-align:center"> <?php echo $row['Department']; ?> </td> <td hidden> <input type="text" name="Department[]" id="Department" value=" <?php echo $Department; ?> " style="width:100px" readonly /> </td> <td> <?php echo $row['Description']; ?> </td> <td hidden> <input type="text" name="Description[]" id='Description' value=" <?php echo $row; ?> " style="width:100px" readonly /> </td> <td style="text-align:center" hidden> <?php echo $Indicative_Margin; ?> % </td> <td style="width:100px"> <input type="number" class="form-control ExcavatorTarget " name="ExcavatorTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control ExcavatorActual calc" name="ExcavatorActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control GraderTarget " name="GraderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control GraderActual calc" name="GraderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control WheelLoaderTarget " name="WheelLoaderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control WheelLoaderActual calc" name="WheelLoaderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control SLMTarget " name="SLMTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control SLMActual calc" name="SLMActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control RevenueTarget " name="RevenueTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="RevenueTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control RevenueActual" name="RevenueActual[]" id="RevenueActual" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" value="" style="width:100%" readonly /> </td> <td style="width:100px" hidden> <input type="number" name="Margin[]" class="form-control Margin" id="Margin" value="" style="width:100%" readonly autocomplete="off" /> </td> <td hidden align='center' style="width:10%"> <input type="checkbox" checked="checked" class="checkbox" name='lang[]' value="1" /> </td> </tr> <?php } ?> </tbody> </table> </div> <div style="text-align:center"> <input type="submit" name="addInvoice" class="addInvoice" id="addInvoice" value="Submit" style="width:100px;background: #0A2558;margin-top:10px; color:white;font-family:Cambria;border-radius:5px;height:30px;" /> </div> </form> Can you please suggest me for this
  12. Dear ginerjm, In my databse for Excavator--> Pure Parts --> Jan --> 12 and Excavator--> Rock Breaker --> Jan --> Null. Example: When i am selecting Jan month on my table i want it should display on S.no:1--> Pure Parts --> Excavator Target in Lakhs --> 12 and S.no:2--> Rock Breaker --> Excavator Target in Lakhs should disblay blank. When i am selecting March month on my table i want it should display on S.no:1--> Pure Parts --> Excavator Target in Lakhs --> 098 and S.no:2--> Rock Breaker --> Excavator Target in Lakhs --> 657. Like above all the values should display the category target as per the description in databse. I am not getting any idea, how to do this.
  13. Dear team, I am having two tables. One is to set the target values month wise and another one is to update the actual value agains the target month wise (display the target value). Once i set the target value, it is inserting the databse properly. My databse is My another page whis is using to update the actual values is looks like this In above picture, once i select the month, the target value should display automatically on desctiption inrow and category in column. My table code is <form method="POST" action="" onsubmit="return confirm('Are you sure you want to submit?');"> <div style="display: inline-block"> Select Month:<input type="month" name="month" class="month" id="month" onchange="myFunction()" placeholder="Select Month" required value="" style="width:auto;border:solid; border-color:black;font-family:Cambria;border-radius:5px;height:30px;margin-bottom:10px" /> </div> <div style="display: inline-block"> <input type="text" hidden name="dealerid" class="dealerid" id="dealerid" value="<?PHP echo $Emp_No ?>" style="width:100px" /> </div> <div class="tbl_fixed"> <table> <thead> <tr> <th style="width:5%;">S.no</th> <th style="width:10%;">Department</th> <th style="width:25%;">Description</th> <th hidden>Indicative Margin %</th> <th style="width:6%;">Excavator Target in lakh</th> <th style="width:6%;">Excavator Actual in lakh</th> <th style="width:6%;">Grader Target in lakh</th> <th style="width:6%;">Grader Actual in lakh</th> <th style="width:6%;">Wheel Loader Target in lakh</th> <th style="width:6%;">Wheel Loader Actual in lakh</th> <th style="width:6%;">SLM Target in lakh</th> <th style="width:6%;">SLM Actual in lakh</th> <th style="width:6%;">Revenue Target in lakh</th> <th style="width:6%;">Revenue Actual in lakh</th> </tr> </thead> <tbody> <?php $qry=mysqli_query($conn,"SELECT * FROM parts_service "); $n = 1; while($row = $qry->fetch_assoc()){ $Description = $row['Description']; $Department = $row['Department']; $Indicative_Margin = $row['Indicative_Margin']; ?> <tr> <td align='center'> <?php echo $n++ ?> </td> <td style="text-align:center"> <?php echo $Department; ?> </td> <td hidden> <input type="text" name="Department[]" id="Department" value=" <?php echo $Department; ?> " style="width:100px" readonly /> </td> <td> <?php echo $Description; ?> </td> <td hidden> <input type="text" name="Description[]" id='Description' value=" <?php echo $Description; ?> " style="width:100px" readonly /> </td> <td style="text-align:center" hidden> <?php echo $Indicative_Margin; ?> % </td> <td hidden> <input type="text" name="Indicative_Margin[]" class="Indicative_Margin" id="Indicative_Margin" value=" <?php echo $Indicative_Margin; ?> " style="width:100px" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control ExcavatorTarget " name="ExcavatorTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control ExcavatorActual calc" name="ExcavatorActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control GraderTarget " name="GraderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control GraderActual calc" name="GraderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control WheelLoaderTarget " name="WheelLoaderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control WheelLoaderActual calc" name="WheelLoaderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control SLMTarget " name="SLMTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control SLMActual calc" name="SLMActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMActual" value="" style="width:100%" /> </td> <td style="width:100px"> <input type="number" class="form-control RevenueTarget " name="RevenueTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="RevenueTarget" value="" style="width:100%" readonly /> </td> <td style="width:100px"> <input type="number" class="form-control RevenueActual" name="RevenueActual[]" id="RevenueActual" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" value="" style="width:100%" readonly /> </td> <td style="width:100px" hidden> <input type="number" name="Margin[]" class="form-control Margin" id="Margin" value="" style="width:100%" readonly autocomplete="off" /> </td> <td hidden align='center' style="width:10%"> <input type="checkbox" checked="checked" class="checkbox" name='lang[]' value="1" /> </td> </tr> <?php } ?> </tbody> </table> </div> <div style="text-align:center"> <input type="submit" name="addInvoice" class="addInvoice" id="addInvoice" value="Submit" style="width:100px;background: #0A2558;margin-top:10px; color:white;font-family:Cambria;border-radius:5px;height:30px;" /> </div> </form> I dont know how to do this. Van any one help me how to do this
  14. Hello requinix I used the below code as per your instruction $previous_month = date('Y-m', mktime(0, 0, 0, date('n') - 1, 1)); But than also the same problem
  15. I changed the code as per your instruction. But when i am selecting the month from system browser it is displaying like below image When i am selecting month from mobile browser it is displaying like below image In above screen, when i am scroll down the month i am not able to select May month. Automatically it is going to Jun if i scroll it.
  16. Dear Team, I am having a input field which is using for select month. <?PHP $previous_month = date('Y-m', strtotime(date('Y-m') . " -1 month")); $current_month = date('Y-m'); ?> <input type="month" name="Month" id="Month" class="form-control" onchange="viewData()" min="<?php echo $previous_month; ?>" max="<?php echo $current_month; ?>" required style="width:auto;font-family:Cambria;border-radius:5px;height:30px" /> This input will display previous month and cutrrent month only. When i am checking the output of this input is working properly on my laptop browser, i can able to select both the month. But when ia m checking the output on my mobile browser, i can select only current month. ie.. max value. If i scroll down the month list, again it is going to max value only. If suppose the minimum value is -2 (ie.. 2month ) then i can able to select on my mobile browser. But when i am ggiven one month i am not able to select previous month. Can any one suggest me where is the mistake and how to rectify this issue.
  17. Dear mac_gyver, Thanks for your suggession. I had changed the input name for the row total. So now it is updating properly as per my requirement. Thaks for your support.
  18. Dear mac_gyver, Thanks. I have modified the code with reference of above code. Now each month's column total is working properly. But while inserting the values to database the column total value is not inserting as seperate row . it is inserting on the next grade first row. Can you please help me.
  19. Dear Mac_Gyver, Thanks for your reply and this is working exactly as per my requirement. But in this i am facing some issues. I tried for each month's column total with the following code. But only December month is passing on the script. // Column total month wise $(this).closest('tbody').find('.<?=$m?>').each(function () { y = parseInt($(this).val()); col_total += isNaN(y) ? 0 : y; }); $(this).closest('tbody').find('.col_Total<?=$m?>').val(col_total); So i have tried to calculate month wise like bellow code and it is updating the month's column toltal. // Column total Jan $(this).closest('tbody').find('.Jan').each(function () { y = parseInt($(this).val()); col_total += isNaN(y) ? 0 : y; }); $(this).closest('tbody').find('.col_TotalJan').val(col_total); If i use the above code, I have to create for all the 12 month separatly. My final script is <script> $(document).ready(function () { $(".calc").on('input', function () { var row_total = 0; var cat_total = 0; var col_total = 0; var col_total1 = 0,col_total2 = 0,col_total3 = 0,col_total4 = 0,col_total5 = 0,col_total6 = 0,col_total7 = 0,col_total8 = 0,col_total9 = 0,col_total10 = 0,col_total11 = 0; var x; var ms; var y, a, b, c, d, e, f,g,h,i,j,k; // current row total $(this).closest('tr').find('.calc').each(function () { x = parseInt($(this).val()); row_total += isNaN(x) ? 0 : x; }); $(this).closest('tr').find('.Total').val(row_total); // category total $(this).closest('tbody').find('.Total').each(function () { x = parseInt($(this).val()); cat_total += isNaN(x) ? 0 : x; }); $(this).closest('tbody').find('.cat_Total').val(cat_total); // Column total Jan $(this).closest('tbody').find('.Jan').each(function () { y = parseInt($(this).val()); col_total += isNaN(y) ? 0 : y; }); $(this).closest('tbody').find('.col_TotalJan').val(col_total); // Column total Feb $(this).closest('tbody').find('.Feb').each(function () { a = parseInt($(this).val()); col_total1 += isNaN(a) ? 0 : a; }); $(this).closest('tbody').find('.col_TotalFeb').val(col_total1); // Column total Mar $(this).closest('tbody').find('.Mar').each(function () { b = parseInt($(this).val()); col_total2 += isNaN(b) ? 0 : b; }); $(this).closest('tbody').find('.col_TotalMar').val(col_total2); // Column total Apr $(this).closest('tbody').find('.Apr').each(function () { c = parseInt($(this).val()); col_total3 += isNaN(c) ? 0 : c; }); $(this).closest('tbody').find('.col_TotalApr').val(col_total3); // Column total May $(this).closest('tbody').find('.May').each(function () { d = parseInt($(this).val()); col_total4 += isNaN(d) ? 0 : d; }); $(this).closest('tbody').find('.col_TotalMay').val(col_total4); // Column total Jun $(this).closest('tbody').find('.Jun').each(function () { e = parseInt($(this).val()); col_total5 += isNaN(e) ? 0 : e; }); $(this).closest('tbody').find('.col_TotalJun').val(col_total5); // Column total Jul $(this).closest('tbody').find('.Jul').each(function () { f = parseInt($(this).val()); col_total6 += isNaN(f) ? 0 : f; }); $(this).closest('tbody').find('.col_TotalJul').val(col_total6); // Column total Aug $(this).closest('tbody').find('.Aug').each(function () { g = parseInt($(this).val()); col_total7 += isNaN(g) ? 0 : g; }); $(this).closest('tbody').find('.col_TotalAug').val(col_total7); // Column total Sep $(this).closest('tbody').find('.Sep').each(function () { h = parseInt($(this).val()); col_total8 += isNaN(h) ? 0 : h; }); $(this).closest('tbody').find('.col_TotalSep').val(col_total8); // Column total Oct $(this).closest('tbody').find('.Oct').each(function () { i = parseInt($(this).val()); col_total9 += isNaN(i) ? 0 : i; }); $(this).closest('tbody').find('.col_TotalOct').val(col_total9); // Column total Nov $(this).closest('tbody').find('.Nov').each(function () { j = parseInt($(this).val()); col_total10 += isNaN(j) ? 0 : j; }); $(this).closest('tbody').find('.col_TotalNov').val(col_total10); // Column total Dec $(this).closest('tbody').find('.Dec').each(function () { k = parseInt($(this).val()); col_total11 += isNaN(k) ? 0 : k; }); $(this).closest('tbody').find('.col_TotalDec').val(col_total11); // ms calc = each row total/cat_Total * 100 $(this).closest('tbody').find('.Total').each(function (index) { x = parseInt($(this).val()); ms = (isNaN(x) ? 0 : x)/cat_total*100; $(this).closest('tbody').find('.MS').eq(index).val(ms.toFixed(2)); }); }); }); </script> Next problem i am facing is, When i am insert the values to database, Once the first category is completed, the month wise total value is updating on next category because of we merged on first three columns. My inserting code is <?php if(isset($_POST['addInvoice'])){ $Dealer_ID = $_POST['Dealer_Name']; $dealname = mysqli_query($conn, "SELECT * from users WHERE Emp_No = '$Dealer_ID'"); $dealerrow = $dealname->fetch_assoc(); $Dealername = $dealerrow['Name']; $Current_Year = date("Y"); foreach ($_POST['lang'] as $ID => $VAL) { $Category = $_POST['Category_Name'][$ID]; $Model= $_POST['Model_Name'][$ID]; $Jan = $_POST['Jan'][$ID]; $Feb = $_POST['Feb'][$ID]; $Mar = $_POST['Mar'][$ID]; $Apr = $_POST['Apr'][$ID]; $May = $_POST['May'][$ID]; $Jun = $_POST['Jun'][$ID]; $Jul = $_POST['Jul'][$ID]; $Aug = $_POST['Aug'][$ID]; $Sep = $_POST['Sep'][$ID]; $Oct = $_POST['Oct'][$ID]; $Nov = $_POST['Nov'][$ID]; $December= $_POST['Dec'][$ID]; $Total = $_POST['Total'][$ID]; $MS = $_POST['MS'][$ID]; //$query = "UPDATE users SET Branch ='$Branch', Posting_Location ='$Posted_Location', Department='$Department', Divison='$Division', Emp_No='$Emp_No', Name='$Name', Designation='$Designation', User_Type='$User_Type', Functional_Role='$Functional_Role', Employed='$Employed', Mobile='$Mobile', Email='$Email', DOJ='$DOJ', Qualifications='$Qualifications', DOB='$DOB', Approver1_ID='$Approver1_ID', Approver1_Name='$Approver1_Name', Approver2_ID='$Approver2_ID', Approver2_Name='$Approver2_Name' , Approver='$Approver', Gender='$Gender', Blood='$Blood' WHERE id = '$ida'"; $query = "INSERT INTO lastyeardata (Dealer_ID, Dealername, Category, Model, Year, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, December, Total, MS) VALUES ('$Dealer_ID','$Dealername', '$Category','$Model','$Current_Year','$Jan', '$Feb','$Mar', '$Apr', '$May', '$Jun','$Jul', '$Aug', '$Sep','$Oct', '$Nov', '$December','$Total','$MS')"; $result = mysqli_query($conn, $query); if($result) { // echo "<script type='text/javascript'> document.location = 'Users.php'; </script>"; echo '<script type="text/javascript">Swal.fire({ text: "Last Year Data Details added Successfully", icon: "success", showCancelButton: false, confirmButtonColor: "#3085d6", confirmButtonText: "OK" }).then((result) => { if (result.isConfirmed) { window.location.href = "Last_Year_Data.php" } })</script>'; } else { //echo '<script type="text/javascript"> alert("Details are Not Updated.")</script>'; echo '<script type="text/javascript">Swal.fire({ text: "Details are Not Updated. Please check the details entered.", icon: "error", showCancelButton: false, confirmButtonColor: "#3085d6", confirmButtonText: "OK" }).then((result) => { if (result.isConfirmed) { window.history.back() } })</script>'; } } } ?> <form method="POST" action=""> <div style="display: inline-block"> <div class="col-md-12"><label class="control-label">Dealer Name</label> <select name="Dealer_Name" required class="form-control dropdown-toggle Dealer_Name" > <option value="">Select Dealer Name </option> <?php $qry = mysqli_query($conn,"SELECT * FROM users WHERE User_Type ='Dealer' AND status = '1';"); while($row = $qry->fetch_assoc()) { echo '<option value="' . $row['Emp_No'] . '">' . $row['Name'] . '</option>'; } ?> </select> </div> </div> <div id="wrap" class="datalist-wrapper" style="margin-top:-15px"> <div class="loading-overlay"> <div class="overlay-content">Loading...</div> </div> <div class="" id="dataContainer"> <?php // generate month labels foreach(range(1,12) as $m) { $mon[] = ucfirst(date('M',strtotime("2023-$m-01"))); } ?> <table style="margin-top:40px; height:15px" id="example" cellpadding="0" cellspacing="0" border="0" class="datatable table-sm table-hover table-striped table-bordered"> <thead> <tr> <?php $Year = date("y"); $previousYear = $Year - 1; ?> <th style="text-align:center; font-weight:bold;width:2%">S.No</th> <th style="text-align:center; font-weight:bold;width:8%">Category</th> <th style="text-align:center; font-weight:bold;width:8%">Model</th> <?php foreach($mon as $m) {?> <th style="text-align:center; font-weight:bold;width:4.5%"><?=$m.$previousYear?></th> <?php } ?> <th style="text-align:center; font-weight:bold;width:5%">Total</th> <th style="text-align:center; font-weight:bold;width:7%">MS %</th> </tr> </thead> <?php $qry=mysqli_query($conn,"SELECT * FROM model WHERE Brand_ID = '1' order by Category_Name ASC"); $n = 1; // remember last category, to detect when it changes $last_cat = ''; while($row = $qry->fetch_assoc()) { $Category_Name = $row['Category_Name']; $Model_Name = $row['Model_Name']; // detect if the category changed if($last_cat !== $row['Category_Name']) { // test if not the first output if($last_cat !== '') { // close the previous section - output a total row ?> <tr> <td colspan="3" style="text-align:center"> <?PHP echo $last_cat; ?> TOTAL</td> <?php foreach($mon as $m) {?> <td><input type="number" class="form-control col_Total<?=$m?>" name="<?=$m?>[]" style="width:100%" readonly></td> <?php } ?> <td><input type="number" name="cat_Total[]" class="form-control cat_Total" style="width:100%" readonly></td> <td>&nbsp;</td> </tr> <?php } // remember the new category $last_cat = $row['Category_Name']; // start a new section ?> <tbody> <?php } ?> <tr> <td align='center'><?=$n++?></td> <td style="text-align:center"><?=$row['Category_Name']?></td> <td hidden> <input type="text" name="Category_Name[]" id="Category_Name" value=" <?php echo $Category_Name; ?> " style="width:100px" readonly /> </td> <td style="text-align:center"><?=$row['Model_Name']?></td> <td hidden> <input type="text" name="Model_Name[]" id="Model_Name" value=" <?php echo $Model_Name; ?> " style="width:100px" readonly /> </td> <?php foreach($mon as $m) {?> <td><input type="number" class="form-control calc <?=$m?>" name="<?=$m?>[]" style="width:100%" ></td> <?php } ?> <td><input type="number" name="Total[]" class="form-control Total" style="width:100%" readonly></td> <td><input type="number" name="MS[]" class="form-control MS" style="width:100%" readonly></td> <td hidden align='center'> <input type="checkbox" checked="checked" class="checkbox" name='lang[]' value="1" /> </td> </tr> <?php } // end of data loop // if there was any output, close out the last section if($last_cat !== '') { // close the previous section - output a total row ?> <tr> <td hidden> <td colspan="3" style="text-align:center"><?PHP echo $last_cat; ?> TOTAL</td> <?php foreach($mon as $m) {?> <td><input type="number" class="form-control col_Total<?=$m?>" name="<?=$m?>[]" style="width:100%" readonly></td> <?php } ?> <td><input type="number" name="cat_Total[]" class="form-control cat_Total" style="width:100%" readonly></td> <td>&nbsp;</td> </tr> </tbody> <?php } ?> </table> </div> </div> <div style="text-align:center"> <input type="submit" name="addInvoice" class="addInvoice" id="addInvoice" value="Submit" style="width:100px;background: #0A2558;margin-top:10px; color:white;font-family:Cambria;border-radius:5px;height:30px;" /> </div> </form> Can you please help me to insert the values on database along with column total.
  20. Dear Team, I am creating a table with dynamic rows based on the data available on my databse. In that table having input fields on oall the columns. I want to sum of entire row and update on total colum while typing the input. Then sum entire column of total automatically. Then i have to get % of rowtotal & columntotal. In this image the Total column will update the sum of entire row. Out put is 4. Then in colum Total 1260 is the sum of category Excavator. So my for row SM% is (4/1260)*100. Then in 2nd row SM% is (59/1260)*100. For all the category Excavator the SM% should update with divided by 1260. Also for Wheel loader it should update (108/108)*100 and for Grader it should update (21/21)*100. I want the calculation should happen like this. My table code is <table style="margin-top:40px; height:15px" id="example" cellpadding="0" cellspacing="0" border="0" class="datatable table-sm table-hover table-striped table-bordered"> <thead> <tr> <?PHP $Year = date("y"); $previousYear = $Year - 1; ?> <th style="text-align:center; font-weight:bold;width:2%">S.No</th> <th style="text-align:center; font-weight:bold; width:10%">Category</th> <th style="text-align:center; font-weight:bold; width:10%">Model</th> <th style="text-align:center; font-weight:bold;width:4.5%">Jan<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%">Feb<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%">Mar<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.875%"hidden>Q1</th> <th style="text-align:center; font-weight:bold;width:4.5%">Apr<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%">May<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%">Jun<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.875%"hidden>Q2</th> <th style="text-align:center; font-weight:bold;width:4.5%">Jul<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%">Aug<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%">Sep<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.875%"hidden>Q3</th> <th style="text-align:center; font-weight:bold;width:4.5%">Oct<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%">Nov<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%">Dec<?PHP echo $previousYear; ?></th> <th style="text-align:center; font-weight:bold;width:4.5%"hidden>Q4</th> <th style="text-align:center; font-weight:bold;width:4.875%">Total</th> <th style="text-align:center; font-weight:bold;width:4.875%">MS %</th> </tr> </thead> <tbody> <?php // $qry=mysqli_query($conn,"SELECT * FROM users where Approver1_Name = '$Name' OR Approver2_Name = '$Name' "); $qry=mysqli_query($conn,"SELECT * FROM model WHERE Brand_ID = '1' order by Category_Name ASC"); $n = 1; while($row = $qry->fetch_assoc()){ $Category_Name = $row['Category_Name']; $Model_Name = $row['Model_Name']; ?> <tr> <td align='center'> <?php echo $n++ ?> </td> <td style="text-align:center"> <?php echo $Category_Name; ?> </td> <td hidden> <input type="text" name="Category_Name[]" id="Category_Name" value=" <?php echo $Category_Name; ?> " style="width:100px" readonly /> </td> <td style="text-align:center"> <?php echo $Model_Name; ?> </td> <td hidden> <input type="text" name="Model_Name[]" id="Model_Name" value=" <?php echo $Model_Name; ?> " style="width:100px" readonly /> </td> <td > <input type="number" class="form-control Jan" name="Jan[]" id="Jan" value="" style="width:100%" required/> </td> <td > <input type="number" class="form-control Feb" name="Feb[]" id="Feb" value="" style="width:100%" required/> </td> <td > <input type="number" class="form-control Mar" name="Mar[]" id="Mar" value="" style="width:100%" required/> </td> <td hidden> <input type="number" name="Q1[]" id="Q1" class="form-control Q1" value="Q1" style="width:100%" readonly /> </td> <td> <input type="number" class="form-control Apr" name="Apr[]" id="Apr" value="" style="width:100%" required/> </td> <td> <input type="number" class="form-control May" name="May[]" id="May" value="" style="width:100%" required/> </td> <td> <input type="number" class="form-control Jun" name="Jun[]" id="Jun" value="" style="width:100%" required/> </td> <td hidden> <input type="number" name="Q2[]" id="Q2" class="form-control Q2" value="" style="width:100%" readonly/> </td> <td> <input type="number" class="form-control Jul" name="Jul[]" id="Jul" value="" style="width:100%" required/> </td> <td> <input type="number" class="form-control Aug" name="Aug[]" id="Aug" value="" style="width:100%" required/> </td> <td> <input type="number" class="form-control Sep" name="Sep[]" id="Sep" value="" style="width:100%" required/> </td> <td hidden> <input type="number" name="Q3[]" id="Q3" class="form-control Q3" value="" style="width:100%" readonly/> </td> <td > <input type="number" class="form-control Oct" name="Oct[]" id="Oct" value="" style="width:100%" required/> </td> <td> <input type="number" class="form-control Nov" name="Nov[]" id="Nov" value="" style="width:100%" required/> </td> <td> <input type="number" class="form-control Dec" name="Dec[]" id="Dec" value="" style="width:100%" required/> </td> <td hidden> <input type="number" name="Q4[]" id="Q4" class="form-control Q4" value="" style="width:100%" readonly/> </td> <td> <input type="number" name="Total[]" id="Total" class="form-control Total" value="" style="width:100%" readonly/> </td> <td> <input type="number" name="MS%[]" id="MS%" class="form-control MS%" value="" style="width:100%" readonly/> </td> <td hidden align='center'> <input type="checkbox" checked="checked" class="checkbox" name='lang[]' value="1" /> </td> </tr> <?php } ?> </tbody> </table> I am using the following script for calculating Row total and column total <script> $(document).ready(function () { $(".Jan, .Feb, .Mar, .Apr, .May, .Jun, .Jul, .Aug, .Sep, .Oct, .Nov, .Dec ").keyup(function () { $("input[name='Dec[]']").each(function (index) { var Jan = $("input[name='Jan[]']").eq(index).val(); var Feb = $("input[name='Feb[]']").eq(index).val(); var Mar = $("input[name='Mar[]']").eq(index).val(); var Apr = $("input[name='Apr[]']").eq(index).val(); var May = $("input[name='May[]']").eq(index).val(); var Jun = $("input[name='Jun[]']").eq(index).val(); var Jul = $("input[name='Jul[]']").eq(index).val(); var Aug = $("input[name='Aug[]']").eq(index).val(); var Sep = $("input[name='Sep[]']").eq(index).val(); var Oct = $("input[name='Oct[]']").eq(index).val(); var Nov = $("input[name='Nov[]']").eq(index).val(); var Dec = $("input[name='Dec[]']").eq(index).val(); var Row_Total =parseInt(Jan) + parseInt(Feb) + parseInt(Mar) + parseInt(Apr) + parseInt(May) + parseInt(Jun) + parseInt(Jul) + parseInt(Aug) + parseInt(Sep) + parseInt(Oct) + parseInt(Nov) + parseInt(Dec); if (!isNaN(Row_Total)) { $("input[name='Total[]']").eq(index).val(Row_Total); } }); var Column_Total = 0.0; $.each($(".Total"), function (key, input) { if (input.value && !isNaN(input.value)) { Column_Total += parseFloat(input.value); } }) }); }); </script> I was struckup with this position. I dont know how to update MS% row wise. Can any one help me to complete this process.
  21. Dear Mac-Gayer, Thanks for your reply. I created span <span id=file1<?php echo $row['Ass_ID']; ?>><a></a></span> And i append my Directory & Document on this span. $("#file1" + Ass_ID).append('<a target="_blank" href="' + Directory + '/' + Document + '">' + Document + '</a>'); Now it is working properly. Thank you for supporting me.
  22. Dear Mac I get the directory and document values and created the variable on my script. $query = "SELECT * FROM mykra where Month= '$Month' AND Engg_No = '$Employeeid' AND Status = '0'"; $result = mysqli_query($conn, $query); while ($row = mysqli_fetch_array($result)) { $Ass_ID = $row['Row_id']; $Ass_Description = $row['Point_Description']; $Ass_Marks = $row['Point_Marks']; $target = $row['Marks_Target']; $actual = $row['Marks_Actual']; $date = $row['DOS']; $remarks = $row['Marks_Description']; $Document= $row['Document']; $Directory = $row['Directory']; $return_arr[] = array( "Ass_ID" => $Ass_ID, "Ass_Description" => $Ass_Description, "Ass_Marks" => $Ass_Marks, "target" => $target, "actual" => $actual, "date" => $date, "Document" => $Document, "Directory" => $Directory, "remarks" => $remarks ); } echo json_encode($return_arr); for (var i = 0; i < len; i++) { var Ass_ID = response[i].Ass_ID; var Ass_Description = response[i].Ass_Description; var Ass_Marks = response[i].Ass_Marks; var target = response[i].target; var actual = response[i].actual; var date = response[i].date; var remarks = response[i].remarks; var Document = response[i].Document; var Directory = response[i].Directory; document.getElementById('Ass_Description'+Ass_ID).value = Ass_Description; document.getElementById('Ass_Marks'+Ass_ID).value = Ass_Marks; document.getElementById('target'+Ass_ID).value = target; document.getElementById('actual'+Ass_ID).value = actual; document.getElementById('date'+Ass_ID).value = date; document.getElementById('remarks' + Ass_ID).value = remarks; document.getElementById('file' + Ass_ID).value = Document; } but i don't know how to append this on my href. Can yo please help me
×
×
  • 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.