View Single Post
  #2 (permalink)  
Old April 29th, 2004, 02:05 PM
skicrud skicrud is offline
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

found a solution

<?php
include ("header.php");
?>
<html>
<body>
<?php
$name='';
$value='';
if($HTTP_POST_VARS){
    while(list($lvar,$lvalue)=each($HTTP_POST_VARS)){
        if ((ereg("[^1]$",$lvar)) && (ereg("[^\d\w]$",$lvalue))){ //if var does not end in a 1 and

                                        //value not null
        //echo "$lvar=$lvalue<br>"; //echo the var and its value
        //echo "$lvar ";
        //$statement=$lvar;
        //echo "$statement<br>";
        $name=$name . $lvar . ","; //built var string
        $value=$value . $lvalue . "','";
        }
        //echo "$lvalue ";
    }
}
$length=strlen($name); //get length of string
$name=Substr($name,0,($length-1));
$name="($name)"; //strip out last comma
echo "$name<br>";
$length2=strlen($value);
$value=Substr($value,0,($length2-2));
$value="('$value)";
echo "$value<br>";
$sql="INSERT into msdsmasterlist $name VALUES $value ";
$result=mysql_query($sql);
echo $sql;
$num_rows=mysql_affected_rows();
echo $num_rows;
$errors=mysql_error();
echo $errors;











Reply With Quote