I’m trying to take parsed data and store it to a DB. With the way it is currently setup, it only stores the first item on the referenced website in the database. I need it to loop through and save each item to a row in the table. Where do I need to make modifications in my code?
<?php
include('simple_html_dom.php');
// Create DOM from URL
$html = file_get_html('http://www.hiddenurl.com/whatever/');
// Find all article blocks
foreach ($html->find('li.search-result') as $sitelisting)
$con = mysql_connect("localhost", "admin", "mypasshere");
if (!$con) {
die(mysql_error());
}
mysql_select_db("dataminer", $con);
$debugquery = mysql_query("INSERT INTO extract (listing)
VALUES ('$sitelisting')");
if (!$debugquery) {
die(mysql_error());
}
mysql_close($con);
?>
try this
EDIT:
for this
‘use‘for this
’use’EDIT2: