something going wrong here can't fix it
Posted: Fri Mar 09, 2012 7:46 am
hello everybody
briefly no syntax errors, even when i send data to phpmyadmin data stored correctly, but once i submit the form the news from tbl_news which i am printing it out disappears
anyhelp please
briefly no syntax errors, even when i send data to phpmyadmin data stored correctly, but once i submit the form the news from tbl_news which i am printing it out disappears
anyhelp please
<?php
#-----Connecting to DATABASE----#
include("SQL_connect.php");
$gid=0;
if(isset($_GET['id'])){
$gid= intval($_GET['id']);
}
$select = mysql_query("SELECT * FROM tbl_news WHERE id='".$gid."'") or die("CANTNOT EXCUTE THE QUERY");
$rows = mysql_fetch_assoc($select)
echo "<table border='1px' align='center'>
<tr>
<td>Id</td>
<td>Author</td>
<td>Title</td>
<td>Content</td>
</tr>
<tr>///////////// here i am printing out result from tbl_news { after the post every thing disappear }
<td>".$rows['id']."</td>
<td>".$rows['author']."</td>
<td>".$rows['title']."</td>
<td>".$rows['content']."</td>
</tr>
</table>";
##----from---#
if(isset($_POST['name'],$_POST['email'],$_POST['comment'])){
$id = $_POST['id'];
$name = $_POST['name'];
$email = $_POST['email'];
$comment = $_POST['comment'];
$insert = mysql_query("INSERT INTO tbl_comments (name,email,comment,id_join) VALUES ('$name','$email','$comment','$id')") or die("ERROR: INSERTING DATA INTO DATABASE");
}
#-----Form for posting comments----#
echo "<form method='POST' action='".$_SERVER['PHP_SELF']."'>
Name:<br/>
<input type='text' name='name' size='35px' /><br/>
Email:<br/>
<input type='text' name='email' size='35px' /><br/>
Comment:<br/>
<textarea name='comment' cols='40' rows='6'></textarea><br/>
<input type='hidden' name='id' value='".$gid."' /><br/>
<input type='submit' value='Enter Post' />
</form>";
?>