to insert array value in database---important

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • garimapuri@gmail.com

    to insert array value in database---important

    hi
    ihad an array in php and iwant to insert its value in database
    the coding is:

    <?php
    $nv_pairs = explode('&',$qu ery_string);
    $array[50];
    list ($name, $value) = explode ('=',$nv_pairs) ;
    $i = 0;
    foreach($nv_pai rs as $array[$i]) {
    $array[$i]=
    preg_replace('/\%0d%0a+/',"<br> &nbsp;&nbsp;&nb sp;&nbsp;
    ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    ; ",$array[$i]);
    $array[$i]= urldecode ($array[$i]);
    $array[$i]= preg_replace('/\d*\=/', " ",$array[$i]);
    $array[$i]= urldecode ($array[$i]);
    $i++;
    }
    ksort($array);
    while(list($key ,$value)=each($ array)) {
    if (preg_match("/\d+/",$value)) {
    echo "<br> &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;
    &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    &nbsp;&nbsp;&nb sp;<b>$value</b>";
    }
    else {
    echo " <b>$value</b>";
    }
    }
    ?>

    now how can $value be put in database or the ksort value of
    array

  • Jerry Stuckle

    #2
    Re: to insert array value in database---important

    garimapuri@gmai l.com wrote:[color=blue]
    > hi
    > ihad an array in php and iwant to insert its value in database
    > the coding is:
    >
    > <?php
    > $nv_pairs = explode('&',$qu ery_string);
    > $array[50];
    > list ($name, $value) = explode ('=',$nv_pairs) ;
    > $i = 0;
    > foreach($nv_pai rs as $array[$i]) {
    > $array[$i]=
    > preg_replace('/\%0d%0a+/',"<br> &nbsp;&nbsp;&nb sp;&nbsp;
    > ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    > ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    > ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    > ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    > ; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;
    > ; ",$array[$i]);
    > $array[$i]= urldecode ($array[$i]);
    > $array[$i]= preg_replace('/\d*\=/', " ",$array[$i]);
    > $array[$i]= urldecode ($array[$i]);
    > $i++;
    > }
    > ksort($array);
    > while(list($key ,$value)=each($ array)) {
    > if (preg_match("/\d+/",$value)) {
    > echo "<br> &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;
    > &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    > &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    > &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    > &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    > &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    > &nbsp;&nbsp;&nb sp;<b>$value</b>";
    > }
    > else {
    > echo " <b>$value</b>";
    > }
    > }
    > ?>
    >
    > now how can $value be put in database or the ksort value of
    > array
    >[/color]

    Which database? Do you want to put the array all in one row, or
    multiple rows?


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    Working...