Okay, weird mysql error.
when i run the script i get this after 44 entries have been added to the db.
CODE
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 't delete' )' at line 1
then i checked mysqlcc and when I did return all rows i got this error. And I cant delete rows, get the same message again.
CODE
[main-mysql] ERROR 1146: Table 'form.1' doesn't exist
mySQL Query: CODE
CREATE TABLE bookmarks(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
description VARCHAR(500),
url VARCHAR(500))
PHP code: CODE
<?php
mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("form") or die(mysql_error());
$doc = new DOMDocument();
@$doc->loadHTML(file_get_contents('bookmarks.html'));
$links = $doc->getElementsByTagName('a');
for ($i = 0; $i < $links->length; $i++) {
$value = $links->item($i)->nodeValue;
$href = $links->item($i)->getAttribute('href');
mysql_query("INSERT INTO bookmarks(url, description) VALUES('$href', '$value' ) ")
or die(mysql_error());
echo $value . ' <b>[ADDED]</b><br />';
}
?>
[MOD Edit] We don't want your passwords!
This post has been edited by hotsnoj: 22 Jan, 2006 - 02:07 AM