Im creating a database, to hold information about certain websites. Their name, web address, and content......
I have been able to read in the contents of the website independantly using:
<?php
$homepage = 'http://www.google.com';
$fp = fopen($homepage, "rb");
if($fp){
while(!feof($fp)) {
$body = $body . fread($fp, 1024);
}
}
echo $body;
?>
But I want to use this information to put into a db, i.e.
//Enter details with those in database
$sql = "INSERT INTO websites VALUES (NULL,'$name','$homepage','$categories','$body')";
Though every time, I get an error:
Query Failed : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'm Feeling Lucky" name=btnI>&n' at line 1
Ive also tried something like:
$homepage = 'http://www.google.com';
$body = file_get_contents($homepage);
.......but with no luck!
The field for body is defined as LONGTEXT; though notice that the max size is 4kb; would this be the reason?
ANY help would be great!!
Cheers