I made this script (first was a script to delete entries, which worked, now changed it to make it edit database entries.
the aim is, that you first see a textarea whith the text in it, then you can modify it and then the database will be updated.
there are no scripts errors...but nothings happens.
// If an entry has been edited,
// update the database.
if (isset($alter)) {
$sql = "UPDATE features WHERE ID=$alter
SET text='$text'" ;
if (@($sql)) {
echo("<p>The entry has been updated.</p>");
} else {
echo("<p>Error updating entry: " .
mysql_error() . "</p>");
}
}
echo("<p> Here are all the FEATURES in the XSI Base database: </p>");
// Request the ID and text of all the entries
$result = @mysql_query("SELECT ID, text,url,title,picture_name FROM features");
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
// Display the text of each joke in a paragraph
// with a "editthis entry" link next to each.
echo("<p><a href='admin/index.php'>Add a feature</a></p>");
while ( $row = mysql_fetch_array($result) ) {
$id = $row["ID"];
$text = $row["text"];
$title = $row["title"];
$url = $row["url"];
$pciture_name = $row["picture_name"];
echo '<textarea name="text" rows="10" cols="40" wrap>';
echo("$text");
echo '</textarea><br>';
echo '<table border="1"><tr><td rowspan="2" valign="top">';
echo '<a href="' .$row["url"]. '" target="_blank"><img src="' .$row["picture_name"] . '" width="125" height="65" border="0"></a>';
echo("<br>$url");
echo("<br>$title");
echo("<br>$title,$text,$url " .
"<a href='$PHP_SELF?alter=$id'>" .
"Update</a></p>");
echo "</font></td><tr></table>";
}