Jump to content

chrishutagalung

New Members
  • Posts

    8
  • Joined

  • Last visited

chrishutagalung's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi folks, I have this coding problem that I want to pass the PHP variable $row[HEADMARK] and $row[iD] to another page to process update to the oracle DB as user check the checkbox. So on the data.php I have, <html> <head> $('.cuttingCheckbox').change(function() { if (this.checked) { $.post('process_data.php', { headmark : $($row[HEADMARK]).val(), headmark_id : $($row[ID]).val()}, function(response){ this.setAttribute("disabled", true), alert(headmark,headmark_id); }); } }); </script> </head> <?php // IF SHOW KEY HAS BEEN PRESSED if($_POST['action'] == 'show') { $sql = "SELECT * FROM SUB_MASTER_DRAWING WHERE SUB_MASTER_DRAWING.HEAD_MARK = '{$_POST["hm"]}'"; $query = oci_parse($conn, $sql); $query_exec = oci_execute($query); while($row = oci_fetch_assoc($query)){ echo "<table border='1'>"; echo '<table cellspacing = "0"'; echo '<thead>'; echo '<tr><th>Head Mark</th> <th>Cutting</th> </tr></thead>'; echo "<tbody>"; echo "<tr><td><b>$row[HEAD_MARK]/$row[ID]</b></td>"; if ($row['CUTTING'] == 'Y'){ echo "<td><input type='checkbox' id='cuttingCheckbox' name='cuttingCheckbox' checked='checked' disabled='disabled'/></td>"; } else { echo "<td><input type='checkbox' class='cuttingCheckbox' name='cuttingCheckbox' data-labelauty='Cutting done|Cutting NOT done'/></td>"; } echo "</tr>"; echo "</tbody>"; echo "<table cellspacing = '0'"; } echo "</table>"; }//===> END OF 'SHOW' ?> </html> And on the process_data.php should update the variables to the database <?php $cuttingUpdateParse = oci_parse($conn,"UPDATE SUB_MASTER_DRAWING SET CUTTING = 'Y' WHERE HEADMARK = '$_POST[headmark]' AND ID = '$_POST[ID]]'"); $cuttingUpdateRes = oci_execute($cuttingUpdateParse); if ($cuttingUpdateRes){ echo "<script>alert('CUTTING UPDATED');</script>"; } else { echo "<script>alert('ERROR OCCURED');</script>"; } ?> Somehow I couldnot get this code to work. even the alert on the jquery. please help me guys Million thanks
  2. So I have this problem with AJAX. I want to pass the value from the selected dropdown with ajax so that when user selected one of the value in dropdown list(from Oracle DB) it pulls the corresponding value and send it inside the page for processing. So the database schema is like this, HEAD_MARK QTY CUTTING ASSEMBLY WELDING DRILLING FINSHING --------------- ---------- ---------- ---------- ---------- ---------- --------- TEST-2 222 0 0 0 0 0 INI TEST 999 0 0 0 0 0 TEST_RUN1 11 2 2 2 2 2 and my Demo.php is like this. It pulls the Head_mark value from the database and direcly passing the value to process the, 1. Show the corresponding quantity 2. Use the quantity to compare the cutting. Lets say cutting value in the db today is 2 and the quantity is 10. So in the input tag, min="2" and max="10". And user can input new value and update it to the database according to the selected input <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> function OnSelectionChange (select) { var selectedOption = select.options[select.selectedIndex]; //some ajax checkpoint for checking value //alert ("The selected option is " + selectedOption.value); jQuery.ajax({ url: location.href, data: {'hm':selectedOption.value, 'ajax':1}, type: "POST", success: function( data ) { jQuery("#lbl_qty").html(data);//PRINT QTY TO THE SCREEN } }); //some ajax checkpoint //alert('after ajax'); } $(function(){ //insert record $('#insert').click(function(){ var jcutting = $('#fcutting').val(); var jassembly = $('#fassembly').val(); var jwelding = $('#fwelding').val(); var jdrilling = $('#fdrilling').val(); var jfinishing = $('#ffinishing').val(); //syntax - $.post('filename', {data}, function(response){}); $.post('../update_bar/data.php', {action: "insert", cutting:jcutting, assembly:jassembly, welding:jwelding, drilling:jdrilling, finishing:jfinishing}, function(res){ $('#result').html(res); });}); //show records $('#show').click(function(){ $.post('data.php',{action: "show"},function(res){ $('#result').html(res); }); }); }); </script> </head> <body> <?php // DROPDOWN VALUES TO PULL COMPONENT FROM THE DB $result = oci_parse($conn, 'SELECT HEAD_MARK FROM FABRICATION'); oci_execute($result); echo '<SELECT name="headmark" id="headmark" onchange="OnSelectionChange(this.value)">'.'<br>'; echo '<OPTION VALUE=" ">'."".'</OPTION>'; while($row = oci_fetch_array($result,OCI_ASSOC)){ $HM = $row ['HEAD_MARK']; echo "<OPTION VALUE='$HM'>$HM</OPTION>"; } echo '</SELECT>'; ?> <?php // IT DIRECTLY SHOWS THE QUANTITY FOR THE GIVEN HEADMARK WHEN USER SELECT ONE OF THE HEADMARK FROM THE DROPDOWN // BUT IT SHOWS Notice: Undefined index: hm in C:\xampp\htdocs\WeltesInformationCenter\update_bar\demo.php on line 95 $qty_query_result = oci_parse($conn, "SELECT QTY FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"); oci_execute($qty_query_result); oci_bind_by_name($qty_query_result, 'QTY', $quantity); echo 'QUANTITY :'.$quantity; ?> <!-- MAX PLACEHOLDER SHOULD BE GATHERED FROM THE QUANTITY FROM THE CORRESPONDING COMPONENT--> Cutting: <input type="number" min="0" id="fcutting" /> Assembly: <input type="number" min="0" id="fassembly" /> Welding: <input type="number" min="0" id="fwelding" /> Drilling: <input type="number" min="0" id="fdrilling" /> Finishing: <input type="number" min="0" id="ffinishing" /> <button id="insert">Insert</button> <h2>Show Records</h2> <button id="show">Show</button> <p>Result:</p> <div id="result"></div> </body> </html> And the Data.php looks like this <?php //if insert key is pressed then do insertion if($_POST['action'] == 'insert'){ $cutting = $_POST['cutting']; $assembly = $_POST['assembly']; $welding = $_POST['welding']; $drilling = $_POST['drilling']; $finishing = $_POST['finishing']; $sql = "UPDATE FABRICATION SET CUTTING = '$cutting', ASSEMBLY = '$assembly', WELDING = '$welding', DRILLING = '$drilling', FINISHING = '$finishing' WHERE HEAD_MARK = '{$_POST["hm"]}''"; $query = oci_parse($conn, $sql); $query_exec = oci_execute($query); if($query_exec){ oci_commit($query_exec); echo "Record Inserted."; }else { echo "Something Wrong!"; } } //if show key is pressed then show records if($_POST['action'] == 'show'){ $sql = "select * from FABRICATION WHERE HEAD_MARK = 'TEST_RUN1'"; $query = oci_parse($conn, $sql); $query_exec = oci_execute($query); echo "<table border='1'>"; while($row = oci_fetch_assoc($query)){ echo "<tr><td>$row[HEAD_MARK]</td><td>$row[CUTTING]</td><td>$row[ASSEMBLY]</td><td>$row[WELDING] </td><td>$row[DRILLING]</td><td>$row[FINISHING]</td></tr>"; } echo "</table>"; } ?> So basically I dont know how to pass the head_mark value to the function in Data.php. The error is like this, Notice: Undefined index: hm in C:\xampp\htdocs\WeltesInformationCenter\update_bar\data.php on line 35 Warning: oci_parse(): ORA-01756: quoted string not properly terminated in C:\xampp\htdocs\WeltesInformationCenter\update_bar\data.php on line 36 Warning: oci_execute() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\WeltesInformationCenter\update_bar\data.php on line 37 Something Wrong! PLease any kind of help would be appreciated
  3. Hello all, I am designing a program that consists of 1 dropdown list that pulled the value from the ORACLE DB and update the value as we change the Dropdown. I can get everything works except the submit button when we want to update the value. Please help me, I know this is a very simple problem but somehow it doesnt work. Your help with greatly appreciated. Thanks, // ASSUME CONNECTION IS DONE if (isset($_POST["ajax"]) && $_POST["ajax"] == 1) { $sql = "SELECT QTY FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $cutting_sql = "SELECT CUTTING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $assembly_sql = "SELECT ASSEMBLY FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $welding_sql = "SELECT WELDING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $drilling_sql = "SELECT DRILLING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $finishing_sql = "SELECT FINISHING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $stid = oci_parse($conn, $sql); $stid_cutting = oci_parse($conn, $cutting_sql); $stid_assembly = oci_parse($conn, $assembly_sql); $stid_welding = oci_parse($conn, $welding_sql); $stid_drilling = oci_parse($conn, $drilling_sql); $stid_finishing = oci_parse($conn, $finishing_sql); // The defines MUST be done before executing oci_define_by_name($stid, 'QTY', $qty); oci_execute($stid); oci_define_by_name($stid_cutting, 'CUTTING', $cutting); oci_execute($stid_cutting); oci_define_by_name($stid_assembly, 'ASSEMBLY', $assembly); oci_execute($stid_assembly); oci_define_by_name($stid_welding, 'WELDING', $welding); oci_execute($stid_welding); oci_define_by_name($stid_drilling, 'DRILLING', $drilling); oci_execute($stid_drilling); oci_define_by_name($stid_finishing, 'FINISHING', $finishing); oci_execute($stid_finishing); // Each fetch populates the previously defined variables with the next row's data oci_fetch($stid); oci_fetch($stid_cutting); oci_fetch($stid_assembly); oci_fetch($stid_welding); oci_fetch($stid_drilling); oci_fetch($stid_finishing); //echo quantity to the screen echo "<b><font size='10'>".$qty."</font></b></br>"; if ($cutting == $qty){ echo "<p><b><font color='#FF8566' size='5'>CUTTING COMPLETED</font></b></p>"; } else { $maxcutting = $qty - $cutting; echo "<input id='cutting' name='cutting' type='number' min = '0' max = '$maxcutting' placeholder='CUTTING PROGRESS TODAY' class='input'/>"; } if ($assembly == $qty){ echo "<p><b><font color='#FF8566' size='5'>ASSEMBLY COMPLETED</font></b></p>"; } else { $maxassembly = $qty - $assembly; echo "<input id='assembly' name='assembly' type='number' min = '0' max = '$maxassembly' placeholder='ASSEMBLY PROGRESS TODAY' class='input'/>"; } if ($welding == $qty){ echo "<p><b><font color='#FF8566' size='5'>WELDING COMPLETED</font></b></p>"; } else { $maxwelding = $qty - $welding; echo "<input id='welding' name='welding' type='number' min = '0' max = '$maxwelding' placeholder='WELDING PROGRESS TODAY' class='input'/>"; } if ($drilling == $qty){ echo "<p><b><font color='#FF8566' size='5'>DRILLING COMPLETED</font></b></p>"; } else { $maxdrilling = $qty - $drilling; echo "<input id='drilling' name='drilling' type='number' min = '0' max = '$maxdrilling' placeholder='DRILLING PROGRESS TODAY' class='input'/>"; } if ($finishing == $qty){ echo "<p><b><font color='#FF8566' size='5'>FINISHING COMPLETED</font></b></p>"; } else { $maxfinishing = $qty - $finishing; echo "<input id='finishing' name='finishing' type='number' min = '0' max = '$maxfinishing' placeholder='FINISHING PROGRESS TODAY' class='input'/>"; } echo '<section></br></br></br>'; echo ' <input type="submit" value="SUBMIT PROGRESS" class="button red" />'; echo ' <input type="reset" value="RESET FIELDS" class="button" /></br>'; echo ' <input type="button" value="GO TO PAINTING" name="paint" class="button green" /></section>'; if (isset($_POST['paint'])){ echo 'GO TO THE NEXT PAGE'; } if (isset($_POST['submit'])){ echo 'DO SUBMISSION TO THE DATABASE HERE'; } die;} ?> <!-- HTML CODE --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title> Update Fabrication Progress</title> <link type="text/css" rel="stylesheet" href="../css/goldenform/golden-forms.css"/> <link type="text/css" rel="stylesheet" href="../css/goldenform/font-awesome.min.css"/> <script type="text/javascript"> function OnSelectionChange (select) { var selectedOption = select.options[select.selectedIndex]; //some ajax checkpoint //alert ("The selected option is " + selectedOption.value); jQuery.ajax({ url: location.href, data: {'hm':selectedOption.value, 'ajax':1}, type: "POST", success: function( data ) { jQuery("#lbl_qty").html(data);//PRINT QTY TO THE SCREEN } }); //some ajax checkpoint //alert('after ajax'); } </script> <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> </head> <body class="bg-wooden"> <div class="gforms"> <div class="golden-forms wrapper"> <form> <div class="form-title"> <h2>FABRICATION UPDATE</h2> </div><!-- end .form-title section --> <div class="form-enclose"> <div class="form-section"> <fieldset> <legend>&nbsp Select HEADMARK and the details will be shown <span class="bubble blue">1</span></legend> <section> <div class="row"> <div class="col4 first"> <label for="headmark" class="lbl-text tleft">HEADMARK :</label> </div><!-- end .col4 section --> <div class="col8 last"> <!-- POPULATED DROPDOWN LIST FROM THE DB --> <label for="headmark" class="lbl-ui select"> <?php $sql_hm_comp = 'SELECT HEAD_MARK FROM FABRICATION'; $result = oci_parse($conn, $sql_hm_comp); oci_execute($result); echo '<SELECT name="headmark" id="headmark" onchange="OnSelectionChange(this)">'.'<br>'; echo '<OPTION VALUE=" ">'."".'</OPTION>'; while($row = oci_fetch_array($result,OCI_ASSOC)){ $HM = $row ['HEAD_MARK']; echo "<OPTION VALUE='$HM'>$HM</OPTION>"; } echo '</SELECT>'; ?> </label> </div> </div> </section><!-- END OF DROPDOWN LIST --> <section> <div class="row"> <div class="col4 first"> <label for="lnames" class="lbl-text tleft">Total Quantity:</label> </div> <div class="col8 last"> <!-- VALUE PASSED FROM AJAX PROCESSING --> <label id='lbl_qty' class='lbl-ui'><font size='3'></font></label> </div> </div> </section> </div> </div> <div class="form-buttons"> </div> </form> </div> </div> <div></div> <div></div> </body> </html>
  4. Hi folks, I am having problem with my project. I need to show the corresponding values from the populated drop down list. so in my table i have this. I need to show the quantity from the head_mark i chose from the populated drop down list. Please help me <?php $paint_parse = oci_parse($conn, 'SELECT HEAD_MARK FROM PAINTING ORDER BY REV_DATE'); oci_define_by_name($paint_parse, 'HEAD_MARK', $head_mark); oci_execute($paint_parse, OCI_DEFAULT); ?> <section> <div class="row"> <div class="col4 first"> <label for="headmark" class="lbl-text tleft">HEADMARK :</label> </div><!-- end .col4 section --> <div class="col8 last"> <label for="headmark" class="lbl-ui select"> <select id="headmark" name="headmark" onChange=""> <?php while (oci_fetch($paint_parse)){?> <option value="headmark_sel" id="headmark"> <?php echo "$head_mark"; ?></option> <?php } ?> </select> </label> </div> </div> </section> <section> <div class="row"> <div class="col4 first"> <label for="lnames" class="lbl-text tleft">Total Quantity:</label> </div><!-- end .col4 section --> <div class="col8 last"> <label class="lbl-ui"> <!-- Show Corresponding head mark quantity in this field --> <h1><?php $qty_parse ?></h1> </label> </div><!-- end .col8 section --> </div><!-- end .row section--> </section>
  5. Hi What i have is this.. what am i doing wrong here ?? Im not getting any output from the dropdown list // Assume its connected to the DB <?php $paint_parse = oci_parse($conn, 'SELECT HEAD_MARK FROM FABRICATION'); oci_execute($paint_parse, OCI_DEFAULT); // Count the number of occurence inside the table $result = array(); $numrows = oci_fetch_all($paint_parse, $result, null, null, OCI_FETCHSTATEMENT_BY_ROW); $value = ''; while ($row = oci_fetch_array($paint_parse)!= false){ $value .= "<option value = '{$row['HEAD_MARK']}'>{$row['HEAD_MARK']}</option>\n"; } ?> <!DOCTYPE html> <html> <head> <title> PT.Weltes Energi Nusantara </title> <header> </header> </head> <body> <select> <?php echo $value; ?> </select> <?php echo $numrows; ?> </body> </html>
  6. Hi folks, Is there any specific ORACLE method to show the traffic, data changes and specific user that logged in and made changes ? I need help with this since i need to show the user WHAT, WHEN, and WHO made the changes with the database values. Can I monitor this traffic daily and make some kind of report with PHP ? Any help would be really appreciated Thanks.
  7. Hi Folks, I am new here and I am building a dummy business application for my school project. So I am still learning from you guys and please guide me with what i have right now. So, I want to populate a dropdown list with rows that exists in my Oracle DB and that would be my COMPONENT_ID column. When i pull that component ID column and select one of them, I need to show the corresponding data that show progress from that particular item. So when i choose one of the ID, I need to show the rest of the column that is in the same row with that particular item. What i have right now is this. I am assuming this will only pull the component ID but it doesnt work either. So please help me... <?php $paint_parse = oci_parse($conn, 'SELECT HEAD_MARK FROM FABRICATION'); oci_execute($paint_parse, OCI_DEFAULT); // Count the number of occurence inside the table $result = array(); $numrows = oci_fetch_all($paint_parse, $result, null, null, OCI_FETCHSTATEMENT_BY_ROW); while ($row = oci_fetch_array($paint_parse, OCI_ASSOC)!= false){ $value = $row['HEAD_MARK']; echo "<option value = $value>$value</option>"; } ?>
×
×
  • 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.