I scraped date from another website and then insert all fetching values into my table sracp-data. My Value insert successfully, but only last value insert.
My Fetching values look like:
My Fetching Cood:I Used for scraping data with SIMPLE HTML DOM
include './simple_html_dom.php'; //Inlcude HTML DOM
$html = file_get_html('http://tacticalwalls.com/shop/'); //Scrapping site/url
//**ul[class=products] here is specific DIV values**
foreach ($html->find('ul[class=products]') as $items) {
foreach ($items->find('a') as $anchor) {
$item_a = $anchor->href;
}
foreach ($items->find('img') as $img){
$item_img = $img->src;
}
$db_conn = mysql_connect('localhost', 'root', '') or die('error');
mysql_select_db('db_scrap', $db_conn) or die(mysql_error());
$sql = "INSERT INTO scrap_data(url, imges) VALUES ('".$item_a."', '".$item_img."')";
mysql_query($sql) or die(mysql_error());
}
My Problem is, How can I Insert all fetching value into table specific column. Like < a > Tag insert into the url column and < img > tag value insert into the images colunmn?