Jump to content

Help with MYSQL PHP


thisisnuts123

Recommended Posts

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 ++;

}

}

 

}

 

 

*/

Link to comment
Share on other sites

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?

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.