Re: [PHP] Problem with a dinamic variable --> array

2003-07-23 Thread Curt Zirzow
* Thus wrote Wan Do Ke ([EMAIL PROTECTED]):
> Here its the scenario:
> 
> i have a table with campo1x, campo1y, campo2x, campo3y, . campo10x,
> campo10y on the table ejes
> 
> so what i need to do is to split an array that i send to this page on php ..
> and include the values on this fields (but only on the fields that the $num
> its writen)
> (this is make by this way because the data is from flash)
> 
>  
> 
> $propiedades= array("x","y");
> 
> // this values came from a $_POST (not now but they will)
> 
> $ejey ="1,2,3,4";
> $ejex = "1,3,22,4";
> $num= "1,2,5,7";
> 
> 
> $valx = split(",", $ejex);
> $valy = split(",", $ejey);

It might make it easier if you set up your val as:
  $val['x'] = split(",", $ejex);
  $val['y'] = split(",", $ejey);

> $numo= split(",", $num);
> 
> for ($i = 0; $i < count($numo) ; $i++) {

>  for ($e = 0; $e < 2 ; $e++) {
  // then: and the current propiedades 
 $thispropiedads = $propiedades[$e];
> 
>   // here its campo1x so then on the update i know wich field i have to
> update...
>   // the problem is that i dont know how can i retrive the value of $valx
> and $valy
> // this is OK .. because i know the name of the field that i
> have to update... my problem is to catch the value !
>   $a="campo" .$numo[$i] . $propiedades[$e];
// just to use the vars i set up
$a = "campo" . $numo[$i] . "$thispropiedads";
> 
>  /* this is WRONG ! i need $valy[0] or $valx[0] values checking
> with $propiedades[$e]
> 
>$b="\$val" . $propiedades[$e]. [$e];
   // i think your mistake originally is that last $e should
   // be $i instead..

   // Using the array I setup above would be:
   $b = $val[$thispropiedads][$i];
> 
> 
>   */
> 
>   // wrong the $b
>   $result2 = mysql_query("UPDATE ejes SET $a='$b'", $Connect);
> 
> 
>  }
> }
> 
> 
> ?>

That should work.

btw, next time Compose a new message when starting a new topic.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problem with a dinamic variable --> array

2003-07-23 Thread Wan Do Ke
Here its the scenario:

i have a table with campo1x, campo1y, campo2x, campo3y, . campo10x,
campo10y on the table ejes

so what i need to do is to split an array that i send to this page on php ..
and include the values on this fields (but only on the fields that the $num
its writen)
(this is make by this way because the data is from flash)




Hope some good programmer can help me..
Wan Chan



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php