I am inserting scraped link to my database but when i check in database the number of auto increment records is correct but cado field remains blank. When i insert a default value "test" @ $results_urls[$separate_result]
the records is filled. what mistake have i done
$separate_results = explode("<td class=\"image\">", $results_page); // Expploding the results into separate parts into an array
// For each separate result, scrape the URL
foreach ($separate_results as $separate_result) {
if ($separate_result != "") {
$results_urls[] = "http://www.imdb.com" . scrape_between($separate_result, "href=\"", "\" title="); // Scraping the page ID number and appending to the IMDb URL - Adding this URL to our URL array
$add = "INSERT INTO pourqui(
cado
) VALUES (
'$results_urls[$separate_result]'
)";
$result_add = mysql_query($add);
if (!$result_add) {
die("Database query failed: " . mysql_error());
}
}
use {}
for inserting data from array
$add = "INSERT INTO pourqui(cado) VALUES ('{$results_urls[$separate_result]}')";
^ ^
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.