How can you update a query result performed by a query using php and mysql -
i trying figure out how update "date" result query perform. here code im using perform initial query:
<?php include ("config.php"); $result = mysqli_query($con,"select * redmine.issues join redmine.projects on issues.project_id=projects.id projects.name='".$_session['name']."';"); echo "<table border='0' width='80%' cellpadding='0' cellspacing='2' id='datatable' class='table table-bordered table-condensed table-hover table-striped'> <tr> <th width='50%' align='left'>milestone</th> <th width='25%' align='left'>template date</th> <th width='15%' align='left'>due date</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td align='left'><input class='hidden' type='text' name='subject' id='subject' value='" . $row['subject'] . "'>" . $row['subject'] . "</td>"; echo "<td align='left'>" . $row['created_on'] . "</td>"; echo "<td align='left'><input type='text' name='due_date' id='due_date' value='".$row['due_date']."'></td>"; echo "<td align='left'><input type='submit' value='submit new date'></td>"; echo "</tr>"; } echo "</table>"; echo "<br />"; mysqli_close($con); ?>
this give me result:
---------------------------------------- milestone | created date | due date ---------------------------------------- milestone 1 | 01/22/2015 | 01/22/2015 ----------------------------------------
i want able type in new date in "due date" textbox each milestone , update due date in mysql table milestone.
any appreciated!
i have script.. seems update last mysql query result. example, if have 5 milestones retrieved, can update last mile stone date. if try update other 4 milestone dates, wont update.
<?php include ("config.php"); // values form $subject=$_post['subject']; $due_date=$_post['due_date']; $result = mysqli_query($con,"update redmine.issues join redmine.projects on issues.project_id=projects.id set issues.due_date='$due_date' issues.subject='$subject' , projects.name='".$_session['name']."'"); // close connection mysqli_close($con); ?>
create input[type="text"] field this:
<input type="text" value="something" id="duedate" data-id="12" onchange="function_update()"/>
in function_update() current id data-id="12" , value id="duedate" using ajax onchange event.
Comments
Post a Comment