christa Posted November 30, 2010 Share Posted November 30, 2010 hi my db table has 2 field: ID - Place 1 France 2 Germany My form has 2 text field (printed with while cycle). mysql_query("UPDATE mytable SET Place = '" . $_POST['place'] . "' WHERE ID=". $_POST['ID']." "); This query doesn't work, because updates only the last record. Where is wrong? many thanks Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted November 30, 2010 Share Posted November 30, 2010 You lost me, what doest work and what do you need ? Quote Link to comment Share on other sites More sharing options...
christa Posted November 30, 2010 Author Share Posted November 30, 2010 My db table has 2 fields: ID - Place 1 France 2 Germany My form has 2 text fields: input name=State1 input name=State2 if I digit Italy in inputname=State1 only updates ID 1 if I digit Spain in inputname=State2 only updates ID 2 So, my db table will become: ID - Place 1 Italy 2 Spain Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted November 30, 2010 Share Posted November 30, 2010 Then you have to check whether the input fields are empty... The same with your query Something like: if ($_POST['State1'] != '') // query if ($_POST['State2'] != '') // query I hope this helps because i still dont get it what you want exactly...... 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.