I'm currently doing a small personal project which I hope to make me strengthen my PHP skills, although I've encountered an issue. At the current time I'm running a MySQL select query and echoing back the results which is working perfectly fine although, I wish to be able to change the content that is displayed within each cell. Here is my code:
Code: Select all
$con = mysql_connect("localhost","supersecretusername","supersecretdatabasepassword");
mysql_select_db("url", $con);
$query = "SELECT URL, Short, Time FROM `url` WHERE UID = '$UID'";
$result = mysql_query($query,$con);
$fields_num = mysql_num_fields($result);
echo "<table border='1'><tr>";
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
while($row = mysql_fetch_row($result))
{
echo "<tr>";
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
I know it's a large amount of help I require, although anything would be greatly appreciated!