実行する必要のあるクエリがあり、2つの問題があります。
最初に私の質問があります:
INSERT INTO `anzie_oscommerce`.`discount_codes` (
`discount_codes_id` ,
`discount_description` ,
`products_id` ,
`categories_id` ,
`manufacturers_id` ,
`excluded_products_id` ,
`customers_id` ,
`orders_total` ,
`order_info` ,
`exclude_specials` ,
`discount_codes` ,
`discount_values` ,
`minimum_order_amount` ,
`expires_date` ,
`number_of_orders` ,
`number_of_use` ,
`number_of_products` ,
`status`
)
VALUES (
'' , 'GALA 2012', '' , '' , '' , '' , '' , '2', '1', '0', substr(md5(uniqid(rand(), true)), 0, 8), 250, '0.0000', '2013-22-06', '0', '1', '0', '1'
);
最初の問題は、phpから取得したuniqid関数で実行しようとしているランダムコードを生成する必要があることですが、それは不可能です。SQLで同様のことを行う方法はありますか?
2番目の問題は、これを250回実行して、250の異なる割引コードを生成する必要があることです。SQLを複数回実行する簡単な方法はありますか?