0

<html>
<body>

<?php

$con = mysql_connect("localhost","root"); if (!$con) { die('Could not connect: ' . mysql_error()); }

mysql_select_db("comentss", $con);

if(isset($_POST['submit'])){ $comment=$_POST['comments']; $q="insert into table2 (comment) values ('$comment')"; mysql_query($q); } $q="select comment from table2"; $result=mysql_query($q); while($row=mysql_fetch_array($result)){ //this is what i want to separate with tables... echo "" . "
" . $row['comment']."";

} ?>

</body>
</html>

Edited by Dani: Code formatting

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by gopi17
0

<html>
<body>

<?php

$con = mysql_connect("localhost","root"); if (!$con) { die('Could not connect: ' . mysql_error()); }

mysql_select_db("comentss", $con);

if(isset($_POST['submit'])){ $comment=$_POST['comments']; $q="insert into table2 (comment) values ('$comment')"; mysql_query($q); } $q="select comment from table2"; $result=mysql_query($q); while($row=mysql_fetch_array($result)){ //this is what i want to separate with tables... echo "" . "
" . $row['comment']."";

} ?>

</body>
</html>

this code is for a "add comment" function. i want the comments to be separated with a table or something..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.