php - Add table row for each table row in database table -
i couldn't find post problem. trying add in html new table row every new table row have in phpmyadmin table php script.
my code is:
<?php if($check == true) { echo" <a href='php/logout.php' class='subpages'>logout</a> <tr> <td> filename: <a href='../uploads/$filename'>$filename</a> </td> <td>"; $connect = mysql_connect("localhost","root",""); mysql_select_db("phplogin"); // select db $getcomment = mysql_query("select comment files name='$filename'"); while($row = mysql_fetch_assoc($getcomment)) { echo"comment: ".$row['comment']." </td> </tr>"; } } ?>
the check @ begging checks if file actualy uploaded if connection made name of file , comment attached it.
then finaly when info has been taken want make table row , 2 colusm filename , comment. result of code replaces created row new one.
is there way create new row each new file , comment has been taken php script ?
try this... please let know working or not...
if($check == true) { echo" <a href='php/logout.php' class='subpages'>logout</a> <table><tbody><tr> <th>file name</th> <th>comments</th> </tr> <tr> <td> filename: <a href='../uploads/$filename'>$filename</a> </td> </tr> "; $connect = mysql_connect("localhost","root",""); mysql_select_db("phplogin"); // select db $getcomment = mysql_query("select comment files name='$filename'",$connect); $res = mysql_fetch_row($getcomment); $num_rows = mysql_num_rows($getcomment); if ($num_row > 0){ ($i=0;$i<$num_row;$i++){ echo "<tr><td><comment: ".$res[$i]."</td></tr>"; } } }
Comments
Post a Comment