Jump to content

[SOLVED] Form and Database help


PrinceOfDragons

Recommended Posts

$SQL1 = "";
$SQL2 = "";

foreach($_POST as $k=>$v)
{
if(empty($v))
	{
	continue;
	}

$SQL1 .= "`$k`, ";
$SQL2 .= "'$v', ";
}

$SQL1 = substr($SQL1, 0, -2);
$SQL2 = substr($SQL2, 0, -2);

$SQL = "INSERT INTO `Table` ($SQL1)
VALUES ($SQL2)";
mysql_query($SQL);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.