empty query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux