IPTC parse
Posted: Fri Apr 18, 2008 12:45 am
Help me with this code please anybody..Maybe it is just a simple mistake but i am really stuck on it and need u guys yo help me out..Tenkiu so much..
<?php $con = mysql_connect("localhost","root","1234");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("bernama", $con);$result = mysql_query("SELECT * FROM fileimage where provider like 'PicturePerfect' and id > 11006 and caption is null limit 0,10");
while($row = mysql_fetch_array($result)) {
echo $row['fileName'] . " " . $row['provider'];
echo "<br />";
$image = "http://www.someurl.com/images/PicturePerfect/". $row['folder'] ."/". $row['fileName'];
$size = GetImageSize ("$image", &$info);
$iptc = iptcparse($info["APP13"]);
$headline = $iptc["2#105"][0];
if (isset ($info["APP13"])) {
$iptc = iptcparse ($info["APP13"]);
print "<b>Headline:</b>".$headline."<BR>";
//I think the problem start here}
$update = mysql_query("UPDATE fileimage SET caption = ".$headline." WHERE provider like 'Reuters' and id > 11006 and caption is null limit 0,10");
while($row = mysql_fetch_array($update)){
echo $update;
if (!$update)
{
die('Could not connect: ' . mysql_error());
}
}mysql_close($con);
}
?>
**I can view the headline successfully but i cant update the headline and save it in database..I need to save it in database because i want to view it in my ASP pages which is already exist and i not found iptc code in ASP.
<?php $con = mysql_connect("localhost","root","1234");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("bernama", $con);$result = mysql_query("SELECT * FROM fileimage where provider like 'PicturePerfect' and id > 11006 and caption is null limit 0,10");
while($row = mysql_fetch_array($result)) {
echo $row['fileName'] . " " . $row['provider'];
echo "<br />";
$image = "http://www.someurl.com/images/PicturePerfect/". $row['folder'] ."/". $row['fileName'];
$size = GetImageSize ("$image", &$info);
$iptc = iptcparse($info["APP13"]);
$headline = $iptc["2#105"][0];
if (isset ($info["APP13"])) {
$iptc = iptcparse ($info["APP13"]);
print "<b>Headline:</b>".$headline."<BR>";
//I think the problem start here}
$update = mysql_query("UPDATE fileimage SET caption = ".$headline." WHERE provider like 'Reuters' and id > 11006 and caption is null limit 0,10");
while($row = mysql_fetch_array($update)){
echo $update;
if (!$update)
{
die('Could not connect: ' . mysql_error());
}
}mysql_close($con);
}
?>
**I can view the headline successfully but i cant update the headline and save it in database..I need to save it in database because i want to view it in my ASP pages which is already exist and i not found iptc code in ASP.