what i am now trying to add, is a picture of a trash can, and when you click on it, it will delete that comment!
here is my current code:
Code: Select all
<?php
//connect to database, select table
$db = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
// show entries
$query = "SELECT csubject, cmessage FROM deltest1";
$result = mysql_query($query) or die('Error, query failed ##1');
// this defines html code i want for the entries. tables... etc.
$htmlsubbefore="(html table code...etc)";
$htmlsubafter="(html table code...etc)";
$htmlbodbefore="(html table code...etc)";
// // // MY DELETE CODE!!!
if(isset($_GET['act']) && $_GET['act'] == 'del'){
$sql_delete = "DELETE FROM deltest1 WHERE cmessage=$id";
mysql_query($sql_delete) or die(mysql_error());
}
// // // END DELETE CODE
echo "<table>";
while($row = mysql_fetch_row($result))
{
$Subject = $row[0];
$Message = $row[1];
//display the entries
echo $htmlsubbefore . $row[0] . $htmlsubafter.
$htmlbodbefore . $row[1] . $htmlbodafter . "</table>";
// NOW here is where i display my trash can image:
echo "<a href='delete3.php?act=del&id=" . $MESSAGE_ID . "' title='Delete'><img src=\"http://image.fpsbanana.com/ico/del.gif\"></a>";
// End trash can image code
}
// more html crap:
$htmlbodafter="</td>/tr></table>";
?>please help?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 '' at line 1