Re: Mysql update problems
| From: | jesse | Date: | Sun, 05 Jan 2003 17:50:32 +0000 |
| Subject: | Re: Mysql update problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130331@lists.php.net to get a copy of this message | ||
No, the query is working fine... all variables are printing correctly. This is what has me confused. Everything seems to be as it should, it's just not updating the db table.
Rick Emery wrote:
what appeared when you printed the text of your query: $query = "update bloggers set cache='$blog', title='$title' where url='$address'"; print $query; I'm thinking that your single quotes preventd $blog, $title, $address form being expanded. ----- Original Message ----- From: "Jesse Lawrence" <lawrence_jesse@yahoo.ca> To: <php-general@lists.php.net> Sent: Sunday, January 05, 2003 10:27 AM Subject: [PHP] Mysql update problems 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 todatabase");$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