<?php
mysql_connect(localhost, root, hey);
mysql_select_db(rssfeed);
$title = $_POST['title'];
$url = $_POST['url'];
echo "<form action='rss.php' method='post'>";
echo "Title";
echo "<input type='text' name='title' size='35' maxlength='150' value='' /><br />";
echo "URL";
echo "<input type='text' name='url' size='35' maxlength='150' value='' /><br />";
echo "<input type='submit' value='submit'>";
echo "</form>";
$sql = "INSERT INTO rssfeed VALUES ('', '$title', '$url')";
mysql_query($sql);
?>
<?php
echo "current feeds: <br />";
$query = "SELECT * FROM rssfeed";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i = 0;
while ($i < $num){
$id = mysql_result($result, $i, "rowID");
$title = mysql_result($result, $i, "title");
$url = mysql_result($result, $i, "url");
echo "$id<b>Title</b> $title : <b>Url</b> $url : <a href='rss.php?d=$id'>[x]</a><br />";
$i++;
}
$d = $_GET['d'];
if ($d = $id){
$delete = "DELETE FROM rssfeed WHERE rowID='$id'";
}
?>
I have two problems with this script.
1) Everytime I refesh a new record is added.
2) The link to delete the record isn't working. Any help with getting this function to work would be great 😉.