Jump to content

PHP AJAX SQL update not working after adding extra record


underlink

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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? :o

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.