This is my first month with php and my first day in here...
Posted: Fri Jun 27, 2008 1:19 pm
Sorry here is wut i did for the delete page....Me stupid..!
<?php
include "config.php";
include "functions.php";
if(isset($_GET['id'])){
$query = "SELECT * FROM photo WHERE id = '" . $_GET['id'] . "'";
//echo $query;
$result = mysql_query($query)or die("Could not SELECT DELETE ENTRY because" . mysql_error());
if(mysql_num_rows($result)>0){
$row = mysql_fetch_array($result);
}else{
header("Location: photos.php");
}
}
if(isset($_POST['submit'])){
$name = mysql_real_escape_string($_POST['name']);
$description = mysql_real_escape_string($_POST['comments']);
$query = "DELETE photo SET name='$name', comments='$description'
WHERE id ='" . $_POST['delete_id'] . "'";
//echo $query;
mysql_query($query)or die("Could not DELETE ENTRY:" . mysql_error());
header("Location: photos.php?status=DELETED");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../css/styleb.css" rel="stylesheet" type="text/css" />
<title>_ BACKHAND pour gerer photos |</title>
</head>
<body>
<div id="wrapper">
<div id="inside">
<h2>Delete Entry</h2>
<table>
<tr>
<th>Name</th>
<th>Comments</th>
<th></th>
</tr>
<tr>
<form action="<?=$_SERVER['PHP_SELF']?>" method="GET">
<td>
<input type="hidden" name="delete_id" value="<?=$row['id']?>" />
<input type="submit" name="delete" value="DELETE ENTRY" />
</form>
<br/>
<form action="photos.php" method="POST">
<input type="submit" name="cancel" value="CANCEL" />
</td>
</form>
</tr>
<?=$table_rows?>
</table>
</div>
</body>
<?php
include "config.php";
include "functions.php";
if(isset($_GET['id'])){
$query = "SELECT * FROM photo WHERE id = '" . $_GET['id'] . "'";
//echo $query;
$result = mysql_query($query)or die("Could not SELECT DELETE ENTRY because" . mysql_error());
if(mysql_num_rows($result)>0){
$row = mysql_fetch_array($result);
}else{
header("Location: photos.php");
}
}
if(isset($_POST['submit'])){
$name = mysql_real_escape_string($_POST['name']);
$description = mysql_real_escape_string($_POST['comments']);
$query = "DELETE photo SET name='$name', comments='$description'
WHERE id ='" . $_POST['delete_id'] . "'";
//echo $query;
mysql_query($query)or die("Could not DELETE ENTRY:" . mysql_error());
header("Location: photos.php?status=DELETED");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../css/styleb.css" rel="stylesheet" type="text/css" />
<title>_ BACKHAND pour gerer photos |</title>
</head>
<body>
<div id="wrapper">
<div id="inside">
<h2>Delete Entry</h2>
<table>
<tr>
<th>Name</th>
<th>Comments</th>
<th></th>
</tr>
<tr>
<form action="<?=$_SERVER['PHP_SELF']?>" method="GET">
<td>
<input type="hidden" name="delete_id" value="<?=$row['id']?>" />
<input type="submit" name="delete" value="DELETE ENTRY" />
</form>
<br/>
<form action="photos.php" method="POST">
<input type="submit" name="cancel" value="CANCEL" />
</td>
</form>
</tr>
<?=$table_rows?>
</table>
</div>
</body>