Hi,
I have a MySQL database where I want to updated multiple records. The
table has two columns:
product_number
product_price
I have a list with first entry product_price, second entry
product_number
@products_param = (
['11.90', '1034K'],
['22.90', '1034R'],
['43.90', '1034U']
); # no comma after last entry
I run the following from a file on the server:
$dbh = DBI->connect($dsn , $login_name, $password)
or die "(Can't connect to MySQL database: $DBI::errstr\n" ;
####### Start products_param FOR loop
$dbh = DBI->connect($dsn , $login_name, $password)
or die "(Can't connect to MySQL database: $DBI::errstr\n" ;
###### Start products_param FOR loop ######
$compiled = $dbh->prepare("
UPDATE products
SET products_price = ?
WHERE products_model = ?
VALUES (?,?)
");
foreach ($products_para m as $products) {
$dbh->execute($compi led, $products);
};
This gives me an "Internal Server" error. I have several PHP and MySQL
books but cannot find the correct syntax.
Any help appreciated.
Al Moodie.
I have a MySQL database where I want to updated multiple records. The
table has two columns:
product_number
product_price
I have a list with first entry product_price, second entry
product_number
@products_param = (
['11.90', '1034K'],
['22.90', '1034R'],
['43.90', '1034U']
); # no comma after last entry
I run the following from a file on the server:
$dbh = DBI->connect($dsn , $login_name, $password)
or die "(Can't connect to MySQL database: $DBI::errstr\n" ;
####### Start products_param FOR loop
$dbh = DBI->connect($dsn , $login_name, $password)
or die "(Can't connect to MySQL database: $DBI::errstr\n" ;
###### Start products_param FOR loop ######
$compiled = $dbh->prepare("
UPDATE products
SET products_price = ?
WHERE products_model = ?
VALUES (?,?)
");
foreach ($products_para m as $products) {
$dbh->execute($compi led, $products);
};
This gives me an "Internal Server" error. I have several PHP and MySQL
books but cannot find the correct syntax.
Any help appreciated.
Al Moodie.
Comment