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 Link to comment https://forums.phpfreaks.com/topic/220221-update-2-record-same-time/ 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 ? Link to comment https://forums.phpfreaks.com/topic/220221-update-2-record-same-time/#findComment-1141290 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 Link to comment https://forums.phpfreaks.com/topic/220221-update-2-record-same-time/#findComment-1141292 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...... Link to comment https://forums.phpfreaks.com/topic/220221-update-2-record-same-time/#findComment-1141305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.