empty query

From: Date: Sun, 26 Jan 2003 06:31:26 +0000
Subject: empty query
Groups: php.db 
Request: Send a blank email to php-db+get-25137@lists.php.net to get a copy of this message
hello, i have unsuccessfully tried for three days to write, re-write something that will insert data into my db and ashamedly have failed again. at one point i was able to echo values and see that they were in fact passing from my form. now i can't even get that. anyway, if you could take a look at this and tell me where i'm going wrong i will greatly appreciate it. thank you... addison <?
  session_start();                                                if (@$auth != "yes")                                            include("config.php");
function storeForm($formdata,$ads) { $query = "INSERT INTO $ads ("; $query2 = " VALUES ("; $counter = 0; foreach ($formdata as $key => $value) {
    $formdata[$key] = trim($formdata[$key]);
    $formdata[$key] = strip_tags($formdata[$key]);
    $counter++;
    if ($counter == sizeof($formdata) ) //if this is last field
    {
      $query = $query.$key;
      $query2 = $query2."'".$value."'";
    }
    else                               //if this is not the last field
    {
      $query = $query.$key.",";
      $query2 = $query2."'".$value."'".",";
    }
} $query = $query.")"; $query2 = $query2.")"; $query=$query.$query2; $result = mysql_query($query)
       or die ("Couldn't execute query.");
} ?> -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 addison@bellsouth.net info@smipco.com subsidiaries of small independent publishing co. info@gloabaldog.com info@momandpocentral.com

« previous php.db (#25137) next »