i am trying to store the output of this question in mysql
filter images from webpage based on size
<?php
include('connect.php');
$html = file_get_contents("http://santabanta.com/photos/amisha-patel/402186.htm");
$doc = new DOMDocument();
@$doc->loadHTML($html);
$tags = $doc->getElementsByTagName('img');
foreach ($tags as $tag) {
$data = get_headers($tag->getAttribute('src'),1);
if((intval($data["Content-Length"])/1024)>=10){
echo $tag->getAttribute('src');
$url=''.$tag->getAttribute('src').'';
echo $url;
mysql_query ("INSERT INTO table1 (url) VALUES ('" . mysql_real_escape_string($url) . "')");
}
}
?>
But to my surprise only first link/link of the output are being stored . i have used echo to check and echo is giving correct output.
My mysql datatype for storing this code is text and i am using this mysql query to insert into mysql but only first line is being saved.
mysql_query ("INSERT INTO tablea (url) VALUES ('" . mysql_real_escape_string($url) . "')");
Everything seems to be fine when getting result from echo but later it is not storing in mysql.
I tried to fill these echo details in form field and to my surprize only first line got filled in form field as well so whatever mysql is storing is as per form field output which i just tried to check whether its mysql problem or what. I executed the query directly in phpmyadmin and everything just got stored but through form it is not getting however echo gives full details.
INSERTstatement. That's what we need to see.mysql_query()? That should give you clues as to why it doesn't store your data