Listing 5. Creating Selected Items Table
mysql>
CREATE TABLE saleitems (
saleid int(11) DEFAULT '0' NOT NULL,
partno int(11) DEFAULT '0' NOT NULL,
quantity int(11) DEFAULT '0' NOT NULL
);
--------php code---------
//would need database connection as above
//also need a mechanism for defining saleid....
while (list($mine,$junk)=each($HTTP_GET_VARS)){
//retrieve the cgi variable names and values as a
//pair from the
//associative array $HTTP_GET_VARS--one pair at a
//time
$queryins=mysql_db_query($db,"INSERT INTO saleitems
(saleid,partno,quantity) VALUES
($thesaleid,$mine,$junk)",$connection);
}
Copyright © 1994 - 2018 Linux Journal. All rights reserved.