php / sql question
Posted: Tue Sep 15, 2009 10:42 pm
Hello.
the code bellow get's and pastes the name of a file, the size of it and when it was uploaded for example "epic.swf - 2Mb - 2009-09-16". in the code i pasted bellow i have a someting i wanna ask. how could i do so that when someone for example clicks on "epic.swf" and "play.php" opens in a new window the row ". $row["name"] . " should print out the name of the file that was clicked in this manner "echo '<a href="/. $row["name"] . "></a>"'" how could i do this?
the code bellow get's and pastes the name of a file, the size of it and when it was uploaded for example "epic.swf - 2Mb - 2009-09-16". in the code i pasted bellow i have a someting i wanna ask. how could i do so that when someone for example clicks on "epic.swf" and "play.php" opens in a new window the row ". $row["name"] . " should print out the name of the file that was clicked in this manner "echo '<a href="/. $row["name"] . "></a>"'" how could i do this?
Code: Select all
<?
$sql = "SELECT * FROM flash ORDER BY date DESC LIMIT 10";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
<?
while ($row = mysql_fetch_assoc($result)) {
echo "<table border=\"0\" width=\"100%\" bgcolor=\"#8b8077\" bordercolor=\"#d3dfe2>\" style=\"border-collapse: collapse\">";
echo "<tr>";
echo "<td width=\"159\">THUMBS;</td>";
echo "<td width=\"159\"><a href=\"play.php\">" . $row["name"] ."</a></td>";
echo "<td width=\"159\">VIEWS;</td>";
echo "<td width=\"159\">" . $row["size"] . "</td>";
echo "<td width=\"194\">" . $row["date"] . "</td>";
echo "</tr>";
echo "</table>";
}
?>
</td>
</td>
</tr>
</tr>
</table>