mattm1712
-
Posts
108 -
Joined
-
Last visited
Posts posted by mattm1712
-
-
sorry in still learning php if thats y u are wonding about my script been messed up
this is my delete
<?
if($_GET["cmd"]=="delete")
{ include 'connect.inc';
$sql = "DELETE FROM comments WHERE comment=$comment";
$result = mysql_query($sql);
echo "Row deleted!";
}
?>
<?php
$dbusername="web123-matt";
$dbpassword="matt";
$dbdatabase="web123-matt";
mysql_connect(localhost,$dbusername,$dbpassword);
mysql_select_db("comments");
if(!isset($cmd))
{
$result = mysql_query("select * from comment order by comment");
while($r=mysql_fetch_array($result))
{
$title=$r["title"];
$comment=$r["comment"];
echo "<a href='delete.php?cmd=delete&name=$name'>$comment - Delete</a>";
echo "<br>";
}
}
?>
-
hi i am trying to design a forum based site i have made a login and comment bits but i cant seem to sort out deleting the comment it deletes all commnents from that user so i have to start again can any1 help this is my comment script,
<?php
if(isset($_POST['submit']))
{
$comment=$_POST['comment'];
if ($comment&&$comment!="")
{
include 'connect.inc';
mysql_query("INSERT INTO comments VALUES('','$comment','$name')");
mysql_close();
}
}
?>
<form action='index.php?variable=P2' name='register' method='post' class='form'>
<input type='text' name='comment'>
<input type='submit' name='submit'>
</form>
<?php
include 'connect.inc';
$query = mysql_query("SELECT * FROM comments;" );
while ($row=mysql_fetch_assoc($query)) {
echo $row[comments]." posted by ".$row[submittedby]."<br>";
}
?>
comment delete help
in PHP Coding Help
Posted
hi im having a problem with the line
while($r = mysql_fetch_assoc($result))
it says
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in