1
How to play a php code, like a comment system.
Using this code I was able to make this possible but, in the same way the code returns only the last query item:
<?php
error_reporting(0);
header("Content-Type: text/html");
header("charset: UTF-8");
$comment_id = $_GET["postID"];
mysql_connect("localhost", "root", "usbw");
mysql_select_db("run");
$cmd = "SELECT * FROM `comments` WHERE `POST_ID` LIKE '$comment_id' LIMIT 0,10";
$cmd_q = mysql_query($cmd);
$xmlpath = "";
while($row = mysql_fetch_array($cmd_q)) {
$xmlpath = "<div id='comment.usr'>" . $row["POST_NAME"] . "</div> disse <div id='comment.content'>" . $row["POST_COMMENT"] . "</div>";
}
?>
<div id="comments">
<?php echo $xmlpath; ?>
</div>
NOTE: If I use $xmlpath += ...
it returns a zero ( 0 )
<div id="comments">
 <?php echo $xmlpath; ?>
</div>
that stretch must be inside the while.– rray
OK I’ll try! .
– FRNathan13
@rray worked! Thank you very much!
– FRNathan13
@rray comment as reply so I mark as accepted!
– FRNathan13
Depending on the CSS, it could work only using
$xmlpath .= "";
inside the while, as it would concatenate all comments.– NewtonWagner