underlink Posted July 30, 2013 Share Posted July 30, 2013 I am building an asset managment system, utilizing some code I found on the net which does live record updates using AJAX, the code is great if I rememeber the link I will post it.However the example code only contains database fields and I need about 14ish, so with my little understanding of the code i started adding more fields. for some reason every time I try to insert the "condition" field the live update stops working for all fields. you can type in new data but does not save back to the database.It happends when i change the code from this: $sql = "update fullnames set AssetID='$AssetID',SerialNumber='$SerialNumber',Type='$Type',Model='$Model' ,Location='$Location' ,Make='$Make' where id='$id'";mysql_query($sql); to this $sql = "update fullnames set AssetID='$AssetID',SerialNumber='$SerialNumber',Type='$Type',Model='$Model' ,Location='$Location' ,Condition='$Condition ,Make='$Make' where id='$id'";mysql_query($sql); the full code is attached. I would really apprisiate any help assets.php table_ajax_edit.php Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/ Share on other sites More sharing options...
trq Posted July 30, 2013 Share Posted July 30, 2013 You are missing a quote: Condition='$Condition should be: Condition='$Condition' Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442670 Share on other sites More sharing options...
underlink Posted July 30, 2013 Author Share Posted July 30, 2013 Yes you are correct, but the original code had the quote and still did not work. quote is wmissing as I typoed when posting the question. Thank for the reply though but still no luck Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442671 Share on other sites More sharing options...
Muddy_Funster Posted July 30, 2013 Share Posted July 30, 2013 perhaps this will offer some assistance : http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442681 Share on other sites More sharing options...
underlink Posted July 30, 2013 Author Share Posted July 30, 2013 Muddy you are my new best friend, my hero... oh hell your my everything!!!! I love you so much I that was it I cant believe it was something so silly as the name of the field. Thank you so much Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442695 Share on other sites More sharing options...
underlink Posted July 31, 2013 Author Share Posted July 31, 2013 Ok I have another question about the same code (I am putting the second question here to save reuploading all the code to a different post) I want to make my input box into a dropdown box. for the purpose of the test it can be manual populated but with the AJAX there I cant make it work the code line is <input type="text" value="<?php echo $Type; ?>" class="editbox" id="type1_input_<?php echo $id; ?>" /> </td> I tried <select class="editbox" id="model1_input_<?php echo $id; ?>"/> <option value= value="<?php echo $Model; ?>">1</option> <option value="2">2</option> <option value="3">3</option></select> </td></tr> But this only turned it into a dropdown but will not populate the record with the selected data from the list Any help would be really helpful Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442789 Share on other sites More sharing options...
Muddy_Funster Posted July 31, 2013 Share Posted July 31, 2013 what's the game plan here? you want to populate the select box with....what? coming from where? in what format? Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442810 Share on other sites More sharing options...
AbraCadaver Posted July 31, 2013 Share Posted July 31, 2013 perhaps this will offer some assistance : http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html Now I was blessed the day I found you Gonna build my whole world around you You're everything good girl and you're all that matters to me You're my everything, you're my everything, yes you are (Don't you know you're my everything) You're my everything, you're my everything (Don't you know you're my everything) You're my everything, you're my everything Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442853 Share on other sites More sharing options...
Muddy_Funster Posted August 1, 2013 Share Posted August 1, 2013 Now I was blessed the day I found you Gonna build my whole world around you You're everything good girl and you're all that matters to me You're my everything, you're my everything, yes you are (Don't you know you're my everything) You're my everything, you're my everything (Don't you know you're my everything) You're my everything, you're my everything ...Did you just call me a girl? Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442911 Share on other sites More sharing options...
underlink Posted August 1, 2013 Author Share Posted August 1, 2013 At some point i will create an SQL table to populate the dropdown but for now I am happy to just use prepopulated data to test with what I need to happen is for the selection made on the dropdown menu to be written back to the database on selection. I have it working for text boxes (defines as <input> tags) here is the live data : http://www.underlink.co.uk/AssetManager/Live_edit/asset.php?test=Asset+3 Quote Link to comment https://forums.phpfreaks.com/topic/280641-php-ajax-sql-update-not-working-after-adding-extra-record/#findComment-1442920 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.