The variable values $rowData
and $altertext
wants to be added in the databse tabe with 2 individual cloumn. So, I written this,
<?php
include_once('simple_html_dom.php');
$link = mysqli_connect("localhost", "root", "", "coupons");
$html = file_get_html('http://www.couponrani.com/');
foreach(($html->find('img') as $imgelement),($html->find('button') as $btnelement)) {
$altertext = $imgelement->{'alt'};
$rowData = $btnelement->{'data-coupon'};
if(preg_match('/\bcoupons\b/i', $altertext, $matches) !== false){
$imp = implode('',$matches);
if(($imp !== '')&&($rowData != '')){
$query = mysqli_query($link,"INSERT INTO couponrani(couponname,couponcode) VALUES ('$altertext','$rowData')",MYSQLI_STORE_RESULT );
}
}
}
?>
But, When I do this it shows me that,
( ! ) Parse error: syntax error, unexpected 'as' (T_AS) in C:\wamp\www\exp.php on line 6
So, How could I correct my code... What mistake I have done....?