<?PHP
//initilize PHP
//if($_POST['submit']) //If submit is hit
//{
//then connect as user
//change user and password to your mySQL name and password
mysql_connect("localhost","xxx_user","xxx");
//select which database you want to edit
mysql_select_db("xxx");
//If cmd has not been initialized
if(!isset($cmd))
{
//display all the news
$result = mysql_query("select * from xxx order by id");
//run the while loop that grabs all the news scripts
while($row = mysql_fetch_array($result))
{
//grab the title and the ID of the news
$naam=$row["naam"];//take out the title
$id=$row["id"];//take out the id
//make the title a link
echo "$id $naam <a href='delete.php?cmd=delete&id=$id'> Delete</a>";
echo "<br>";
}
}
?>
en deze voor delete:
<?PHP
if($_GET["cmd"]=="delete")
{
$sql = "DELETE FROM locaties WHERE id=$id";
$result = mysql_query($sql);
echo "Row deleted!";
}
?>
ik krijg het aleen niet goed werkend.
Warning: mysql_query() [function.mysql-query]: Access denied for user 'root'@'localhost' (using password: NO) Line 5
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established Line 5
iemand een idee?