Jump to content

Array Problem


project3

Recommended Posts

ok, I have a multiple select box which I made an array Im trying to insert the values into the db.

instead of inserting the values its inserting

 

Array[1],Array[2]

 

$this_new is what im inserting into the db at the bottom of the code below.

 

$ix = 1;

$array_count = count($this->MTime);

$this_old = "";

 

while($ix <= $array_count){

 

if ($ix == 1){

$this_old .= "$this->MTime[$ix]";

}else{

$this_old .= ",$this->MTime[$ix]";

}

 

$ix = $ix + 1;

 

}

 

$this_new = $this_old;

Link to comment
https://forums.phpfreaks.com/topic/93392-array-problem/
Share on other sites

what does this give

 

echo '<pre>';
print_r ($this->MTime);
echo '</pre>';

 

 

I changed  the code and took the array out of the " " and it worked.

 

$ix = 0;

$array_count = count($this->MTime);

$array_count = $array_count - 1;

 

$this_old = "";

 

while($ix <= $array_count){

 

if ($ix == 0){

$this_old .= $this->MTime[$ix];

}else{

$this_old .= ",";

$this_old .= $this->MTime[$ix];

}

 

$ix = $ix + 1;

 

}

 

$this_new = $this_old;

 

Link to comment
https://forums.phpfreaks.com/topic/93392-array-problem/#findComment-478450
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.