thisisnuts123 Posted October 14, 2007 Share Posted October 14, 2007 hello all below the code i need help with.. basicly i have bunch of boxes and a dropbox when i drop something in the box it auto calls a funtion which will then update mysql db. but i am unable to do this properly. the below code updates the databse but it is taking the last value how can i change this code so it doesn;t use a loop and just takes the first value and updates it.. i dunt under stand this part foreach($data_array AS $set => $items) how can i make a variable and put the first item in there? thanks /* function update_dropbox($data_array, $col_check) { $i = 0; $o = array(); foreach($data_array AS $set => $items) { foreach($items AS $item) { $item = mysql_escape_string($item); $set = mysql_escape_string($set); $o[$i] = $items; mysql_query("UPDATE layout SET `sitedat` = '$o' WHERE `set` = 'dropbox'"); $i ++; } } } */ Quote Link to comment https://forums.phpfreaks.com/topic/73232-help-with-mysql-php/ Share on other sites More sharing options...
kratsg Posted October 14, 2007 Share Posted October 14, 2007 First of all, I don't understand quite what you want to do. What kind of HTML is on the page? A dropdown box (<select></select>) or a click-drag thing?.. What? Then, when a person "selects", it submits the form and processes php on a diff page? Or you want it to be dynamic? Quote Link to comment https://forums.phpfreaks.com/topic/73232-help-with-mysql-php/#findComment-369451 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.