I am creating a table by echoing results out as the following:
include 'database.php';
$pdo = Database::connect();
$sql = 'SELECT * FROM kayitlar ORDER BY id DESC';
foreach ($pdo->query($sql) as $row)
{
echo '<tr>';
echo '<td>'. $row['model'] . '</td>';
echo '<td>'. $row['problem'] . '</td>';
echo '<td>'. $row['work'] . '</td>';
echo '<td>'. $row['result'] . '</td>';
echo '<td>'. $row['keywords'] . '</td>';
echo '<td>'. $row['addedby'] . '</td>';
echo '<td>'. $row['date_time'] . '</td>';
echo '<td>'. $row['document'] . '</td>';
}
I allowed users to add documents and the file name is being recorded into documents after string operations. I want to display respective documents as hyperlinks. If I was using mysql_fetch array I would use
<td><a href="uploads/<?php echo $row['file'] ?>" target="_blank"> view </a></td>
but I am not good at PDO and getting synthax error everytime.
here is my erroneous code:
echo '<td>'. <a href="uploads/<?php echo $row['document'] ?>" target="_blank">view file</a>.'</td>';