don't quite know what I'm doing wrong here, does anyone have any ideas? I just can't figure it out! I'm trying to run through the files of a directory and putting them into a table, where the filename would go into page_url, title (everthing between the <title></title> tags would go into page_title, and the body (everything in between the <body></body> tags) would go into page_content
<?php
require_once('Connections/Connection.php');
mysql_select_db($database_Connection, $Connection);
//second opening of directory to extract title
$dh = opendir("C:\webfolder");
while (false !== ($filename = readdir($dh))) {
$handle = fopen($filename, "rb");
$buffer = fread($handle, filesize($filename));
//get the title
preg_match('#<title>(.*)</title>#isU', $buffer, $match);
$title = $match[1];
//get the content
preg_match('#<body(.*)</body>#isU', $buffer, $bodymatch);
$body = $bodymatch[1];
$content = strip_tags($body);
$sqlquery = "UPDATE fullSearch set page_title = '$title' , page_content = '$content'
WHERE page_url = '$filename' ";
$results = mysql_query($sqlquery);
fclose ($handle);
}
?>
and yes the folder is C:\webfolder, but it doesn't show up in the preview, so it might not show up in the post