build sql query struture and values from form fields

From: Date: Sat, 20 Aug 2005 20:53:21 +0000
Subject: build sql query struture and values from form fields
Groups: php.general 
Request: Send a blank email to php-general+get-221014@lists.php.net to get a copy of this message
Hello, I would like to create the mysql insert query for my html form fields, I have a small problem it will have an extra , at the end of $sqlstruct And extra "" at $sqldata.. Anyone can give a hint ? //////////// foreach ($_POST as $variable=>$value){ $sqlstruct.=$variable","; $sqldata.=$value."\"','\""; } $query="insert into db ($sqlstruct) VALUES ($sqldata)"; //////////// Best regards, Andras Kende http://www.kende.com -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.13/78 - Release Date: 8/19/2005

« previous php.general (#221014) next »