Announcement

Collapse
No announcement yet.

I need, store values of array into variable i get all the values with echo succefuly

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • I need, store values of array into variable i get all the values with echo succefuly

    Hi,

    I need, store values of array into variable (not echo), i get all the values with echo succefuly but when i pass the variable or update a DB table, either it display or update the field with only the last value

    Example :

    $clients = array("x","xx","xxx");
    $arrlength = count($clients);
    for ($x = 0; $x < $arrlength; $x++) {
    if ($x == 2) {
    $OR= "";
    }
    else {
    $OR= " OR ";

    }



    $all_text = "CLIENT = ". $clients[$x] ." ". $text ." ";


    echo $all_text;

    sc_exec_sql(" UPDATE etat_rh_users SET condition= '[all_text]' where login= 'MKHIAR5L' ");

    }

  • #2
    any solution?? i have same problem

    Comment


    • #3
      i think you need to use foreach or a for loop

      something like this i did for a similar situation

      for ($x = 0; $x <= $rows; $x++) {
      $num=$x+1;
      $sql="update system_owners set priority='".{neworder[$x][1]}."' where id_sort='".{neworder[$x][0]}."'";
      sc_exec_sql($sql);}
      Last edited by scottypaul; 09-17-2017, 04:18 PM.

      Comment

      Working...
      X