smsulliva Posted February 6, 2007 Share Posted February 6, 2007 Can someone tell me what is wrong with this? <? //if ($_POST['update'] == "help") //echo "Thank you! Information updated."; //} if ($_POST['update'] == "help") { $name = $_POST["name"]; $category = $_POST["category"]; $entry = $_POST["entry"]; $related_entries = $_POST["related_entries]"; $required_level = $_POST["required_level"]; $changed_by = $_POST["related_entries"]; // Need to change $last_changed = $_POST["related_entries"]; // Need to change $sql = "UPDATE helpfiles SET category='$category',entry='$entry', related_entries='$related_entries', required_level='$required_level',changed_by='$changed_by', last_changed='$last_changed', WHERE name=$name"; $result = mysql_query($sql); echo "Thank you! Information updated."; } ?> The variables on the form input types are being filled out correctly elsewhere in the code. <form name="form_Add_rating" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="update" value="help"> <table align='center' width='95%'> <tbody> <tr> <td class="tableBar" colspan="2"> </td> </tr> <tr> <td><label for="name">Name</label></td> <td><input name="name" readonly="true" value="<?php echo $item ?>" size="25" type="text" style="background-color:#EFEFEF"> You cannot edit this field.</td> </tr> <tr> <td><label for="category">Category</label></td> <td><input name="category" value="<?php echo $helpArr['category'] ?>" size="25" type="text"></td> </tr> <tr> <td><label for="entry">Description</label></td> <td><textarea name="entry" cols="73" rows="10" value="<?php echo parse_string($helpArr['entry']) ?>" ><?php echo parse_string($helpArr['entry']) ?></textarea> </tr> <tr> <td><label for="related_entries">Related Entries</label></td> <td><input name="related_entries" value="<?php echo parse_string($helpArr['related_entries']) ?>" size="68" type="text"></td> </tr> <tr> <td><label for="required_level">Required Level</label></td> <td><input name="required_level" value="<?php echo parse_string($helpArr['required_level']) ?>" maxlength="1" size="25" type="text"></td> </tr> <tr> <td><label for="changed_by">Changed By</label></td> <td><input name="changed_by" readonly="true" value="{USERNAME}" size="25" type="text" style="background-color:#EFEFEF"> You cannot edit this field.</td> <!-- <td><input name="changed_by" readonly="true" value="<?php echo parse_string($helpArr['changed_by']) ?>" size="25" type="text" style="background-color:#EFEFEF"> You cannot edit this field.</td> --> </tr> <tr> <td><label for="last_changed">Last Changed</label></td> <td><input name="last_changed" readonly="true" value="<?php echo $t_date ?>" size="25" type="text" style="background-color:#EFEFEF"> You cannot edit this field.</td> <!-- <td><label for="last_changed">Last Changed</label></td> <td><input name="last_changed" readonly="true" value="<?php echo parse_string($helpArr['last_changed']) ?>" size="25" type="text" style="background-color:#EFEFEF"> You cannot edit this field.</td> --> </tr> <tr> <td align="center" colspan="2"><input value="Update" type="submit"> <input name="reset" value="Reset" type="reset"> <input type="button" value="Cancel" onclick="javascript:hideBlock('editform')"></td> <!-- <td align='center' colspan='2'><input name='submit' value='Edit ".$item."' type='submit'> <input name='reset' value='Reset' type='reset'> <input type='button' value='Cancel' onClick='javascript:hideBlock(\"editform\")'><input type='hidden' name='cmd' value='edit'></td> --> </tr> </tbody> </table> </form> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 6, 2007 Share Posted February 6, 2007 Please tell us your question. Ken Quote Link to comment Share on other sites More sharing options...
smsulliva Posted February 6, 2007 Author Share Posted February 6, 2007 I figure out why is wasn't posting but I am now getting a syntax error here. Can anybody see what I am doing wrong. $sql = "UPDATE helpfiles SET category='$category',entry='$entry', related_entries='$related_entries', required_level='$required_level',changed_by='$changed_by', last_changed='$last_changed', WHERE name = '".$name."'"; I get this error mysql_query(): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE name = 'Building_credit'' Quote Link to comment Share on other sites More sharing options...
smsulliva Posted February 6, 2007 Author Share Posted February 6, 2007 I figure out what I was doing wrong thanks anyany Quote Link to comment Share on other sites More sharing options...
christophe Posted February 6, 2007 Share Posted February 6, 2007 can you post how you fixed this issue as it helps others in the community Thanks Alex Quote Link to comment Share on other sites More sharing options...
mjlogan Posted February 6, 2007 Share Posted February 6, 2007 $sql = "UPDATE helpfiles SET category='$category',entry='$entry', related_entries='$related_entries', required_level='$required_level',changed_by='$changed_by', last_changed='$last_changed', WHERE name = '".$name."'"; im guessing it was the , before the where part of the sql statement. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.