jbrill Posted July 19, 2007 Share Posted July 19, 2007 Hey guys, Im trying to update some rows in my database and i cannot figure out why it will not update, as far as i know my statements are proper.. thanks in advance! <?php include 'admin_header.php'; $stepid = $_GET['stepid']; //This gets data for the job and does the math equations $results = "SELECT * FROM guestbook WHERE id='$stepid'"; $resultsql = mysql_query($results); $result = mysql_fetch_array($resultsql); //this updates the selected info $update = "UPDATE guestbook SET actual_time='".$_POST['actual_time']."', complete='".$_POST['complete']."', cost='".$_POST['cost']."' WHERE id='$stepid'"; ?> <form method="post" name="updateinfo"> <input type="text" name="actual_time" value="<? echo "".$result["machine_time"]."";?>"> <input type="text" name="cost" value="<? echo "".$result["cost"]."";?>"> <br> <table width="600" bgcolor="#ffffff" class="MainBody1" align="center"> <tr> <td>Machine Time</td> <td>Setup Time</td> <td>Notes</td> <td>Category</td> <td>SubCategory</td> <td>Complete</td> </tr> <tr> <td><? echo "".$result["machine_time"]."";?></td> <td><? echo "".$result["setup"]."";?></td> <td><?echo "".$result["notes"]."";?></td> <td><?echo "".$result["cat"]."";?></td> <td><? echo "".$result["subcat"]."";?></td> <td> <select name="complete"> <? $compsql = "SELECT DISTINCT status FROM complete"; $comp = mysql_query($compsql); $complete = mysql_fetch_array($comp); do { if($complete['status']==$result['complete']) { echo "<option selected value='".$complete['status']."'>".$complete['status']."</option>"; } else { echo "<option value='".$complete['status']."'>".$complete['status']."</option>"; } } while ($complete = mysql_fetch_array($comp)); ?> </select> </td> </tr> <tr> <td colspan="6" align="center"><input type="submit" name="finish" value="Confirm Your Time - Finish"></td> </tr> </table> </form> <?php include 'admin_footer.php'; ?> Link to comment https://forums.phpfreaks.com/topic/60846-why-will-this-not-update/ Share on other sites More sharing options...
akitchin Posted July 19, 2007 Share Posted July 19, 2007 you're just defining the query as a string, but not actually passing it to mysql_query(). am i missing something blindingly obvious here? Link to comment https://forums.phpfreaks.com/topic/60846-why-will-this-not-update/#findComment-302724 Share on other sites More sharing options...
jvrothjr Posted July 19, 2007 Share Posted July 19, 2007 I see query string build $update = "UPDATE guestbook SET actual_time='".$_POST['actual_time']."', complete='".$_POST['complete']."', cost='".$_POST['cost']."' WHERE id='$stepid'"; But now execute line? mysql_query($update); Link to comment https://forums.phpfreaks.com/topic/60846-why-will-this-not-update/#findComment-302727 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.