gavin.sibley Posted March 19, 2012 Share Posted March 19, 2012 Hey, im trying to fix a line of code that should update a field in the database when filled in. The code i think handles this is below. <input type="text" id="uuser_address" name="uuser_address" value="<?php echo("$slide[address]"); ?>"><br /><input type="text" id="uuser_town" name="uuser_town" value="<?php echo("$slide[town]"); ?>"><br /><input type="text" id="uuser_county" name="uuser_county" value="<?php echo("$slide[county]"); ?>"><br /><input type="text" id="uuser_postcode" name="uuser_postcode" value="<?php echo("$slide[postcode]"); ?>"></div> can anyone tell me why this is updating all the address fields other than the postcode? thanks, gavin Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/ Share on other sites More sharing options...
Nodral Posted March 19, 2012 Share Posted March 19, 2012 Without seeing your sql code, this is fairly impossible to explain. Can you also use code tags, tabs and newlines for your code, at least then we get half a chance at seeing what's going on. Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/#findComment-1329023 Share on other sites More sharing options...
gavin.sibley Posted March 19, 2012 Author Share Posted March 19, 2012 sorry, completely new to php and trying to fix something that was built elsewhere. could you explain in more detail exactly what you want? then i can get it all for you and hopefully get it fixed thanks Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/#findComment-1329026 Share on other sites More sharing options...
Nodral Posted March 19, 2012 Share Posted March 19, 2012 ok, you've said that the code is updating all the fields in your database, but have not given the code which could feasibly do this. It will be in your script as "UPDATE ****............................WHERE................" Also, if you wrap your code in tags which are @[@code@] "code here" [@/code@]@ (remove the @ signs). Once you've got the tags in place, put linebreaks in to make it easier to read, you may even spot a few errors youself. eg <input type="text" id="uuser_address" name="uuser_address" value="<?php echo("$slide[address]"); ?>"> <br /> <input type="text" id="uuser_town" name="uuser_town" value="<?php echo("$slide[town]"); ?>"> <br /> <input type="text" id="uuser_county" name="uuser_county" value="<?php echo("$slide[county]"); ?>"> <br /> <input type="text" id="uuser_postcode" name="uuser_postcode" value="<?php echo("$slide[postcode]"); ?>"> </div> (wasn't that much more of a please to read!! lol) Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/#findComment-1329027 Share on other sites More sharing options...
Muddy_Funster Posted March 19, 2012 Share Posted March 19, 2012 that's the code for the form, the bit that people interact with that you posted...Nodral covered the rest while I was typing Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/#findComment-1329028 Share on other sites More sharing options...
gavin.sibley Posted March 19, 2012 Author Share Posted March 19, 2012 ok thanks both, ill have a scout around now and see if i can find it! Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/#findComment-1329031 Share on other sites More sharing options...
gavin.sibley Posted March 19, 2012 Author Share Posted March 19, 2012 i think i have found it! i found this in a different php script. $query = mysql_query("UPDATE `temp_users` SET `book_stage` = '1', `title` = '$title', `fname` = '$fname', `lname` = '$lname', `address` = '$address', `town` = '$town', `county` = '$county', `postcode` = '$postcode', `telephone` = '$telephone', `email` = '$email', `venue_name` = '$venue_name', `venue_county` = '$venue_county', `start_time` = '$start_time', `end_time` = '$end_time', `special_instructions` = '$special_instructions', `password` = '$password', `time_total` = '$time_total', `hrs` = '$hrs', `added_stamp` = '$timeme' WHERE `id` = '$temp[id]'"); hope this is the one! thanks Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/#findComment-1329036 Share on other sites More sharing options...
Muddy_Funster Posted March 19, 2012 Share Posted March 19, 2012 are you sure this is the table you are looking at? " `temp_users` "? if it is in the line imediately following that query add this in a new line: die ($query); and post up what comes up on the screen. Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/#findComment-1329053 Share on other sites More sharing options...
gavin.sibley Posted March 19, 2012 Author Share Posted March 19, 2012 once thats added in nothing appears, and it still doesnt work for some reason. Quote Link to comment https://forums.phpfreaks.com/topic/259257-updating-field/#findComment-1329075 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.