database - PHP mysqli adding multipe entries for one insert -
the following short php code should adding 1 entry database table. when run find 3 identical entries.
mysql server version: 5.5.39 - mysql community server
php/5.4.31
<?php // connect temp db $db_host = "localhost"; $db_username = "root"; $db_password = ""; $db_name = "tempdb"; // create connection $conn = new mysqli($db_host, $db_username, $db_password, $db_name); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $mysqlstr = " insert tempproduct ( `productname`, `merchantid`, `merchant`, `mylink`, `thumbnail`, `bigimage`, `price`, `retailprice`, `category`, `subcategory`, `description`, `custom1`, `custom2`, `custom3`, `custom4`, `custom5`, `lastupdated`, `productstatus`, `manufacturer`, `partnumber`, `merchantcategory`, `merchantsubcategory`, `shortdescription`, `isbn`, `upc`, `sku`, `crosssell`, `merchantgroup`, `merchantsubgroup`, `compatiblewith`, `compareto`, `quantitydiscount`, `bestseller`, `addtocarturl`, `reviewsrssurl`, `option1`, `option2`, `option3`, `option4`, `option5`, `mobileurl`, `mobileimage`, `mobilethumbnail` ) values( 'fossil editor leather ladies watch es3242', '32800', 'pricefalls.com', '[some url]', '[some url]', '[some url]', '113.10', '145', 'fashion', 'jewelry', 'stainless steel case. white leather strap. white dial. day date , 24-hour time. quartz movement. water resistant 50 meters. case 38mm. buckle closure.', 'silver', 'stainless steel', '', '38', 'female', '2015-06-24 14:21:30', 'instock', 'fossil', 'es3242', 'jewelry & watches', 'watches', 'stainless steel case. white leather strap. white dial. day date , 24-hour time. quartz movement. water resistant 50 meters. case 38mm. buckle closure.', '', '691464976040', '4907551', '', '', '', '', '', '', '0', '', '', '', '', '', '', '', '', '', '' )"; mysqli_query($conn,$mysqlstr); // $conn->query($mysqlstr); echo "done"; $conn->close(); ?>
Comments
Post a Comment