Mysql update problems
| From: | Jesse Lawrence | Date: | Sun, 05 Jan 2003 16:27:50 +0000 |
| Subject: | Mysql update problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-130324@lists.php.net to get a copy of this message | ||
I've been scratching my head over the following code
for a while now. It's supposed to check a given
weblog for specific tags, and if they're present,
update the weblog's table in my database. I believe
the problem is around the execution of the db query,
but I can't seem to get it figured out.
function is_news($address, $blogtitle, $host, $user,
$pass, $dbname){
$f = fopen($address, 'r');
$read = fread($f, 20000);
fclose($f);
$title_start = strpos($read, "<BCtitle>");
$title_end = strpos($read, "</BCtitle>");
$title = substr($read, $title_start, ($title_end -
$title_start));
$blog_start = strpos($read, "<BCblog>");
$blog_end = strpos($read, "</BCblog>");
$blog = substr($read, $blog_start, ($blog_end -
$blog_start));
$link = mysql_connect($host, $user, $pass)
or die("Can't connect to
database");
$query = "update bloggers set cache='$blog',
title='$title' where url='$address'";
if(mysql_db_query ($dbname, $query, $link)) {
$is_news = 1;
}else{
$is_news = 0;
}
return $is_news;
}
Thanks a million for any help,
Jesse Lawrence
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca