Below is my Php code. Would anyone be able to tell me how to remove the hyperlinking of every single SQL entry in this code?
As I don't want my users to click into any of the entries and then directed to another web page. I just want a static table with entries from my sql database.
Thanks very much!
<?
#Get the event id from $_GET
$int_event_id = $_GET["EventID"];
if((int)$int_event_id)
{
$pdo = new PDO('mysql:host=localhost;dbname=clubresults', 'root', '12345678');
#Set Error Mode to ERRMODE_EXCEPTION.
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = $pdo->query("SELECT EventName, Score, Place from results WHERE EventID ='$int_event_id' ORDER By EventID ASC");
$rowset = array();
if ($query) {
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
// Build array of rows
$rowset[] = $row;
}
// Output header first
$headrow = $rowset[0];
print("<table border=\"1\">\n<tr>\n");
// Use $rowset[0] to write the table heading
foreach ($headrow as $col => $val) {
printf("<th>%s</th>\n", $col);
}
print("</tr>");
// Then output table rows.
// Outer loop iterates over row
foreach ($rowset as $row) {
print("<tr>");
// Inner loop iterates over columns using $col => $val
foreach ($row as $col => $val) {
// We don't know your column names, but substitute the first column (the ID) for FIRSTCOL here
printf("<td><a href=\"index.php?ID=%s\">%s</a></td>\n", $row['EventID'],$val);
}
print("</tr>");
}
}}
print("</table>");
?>
<a>from yourprintf()echo "<th>$col</th>\n";works just as well. printf should only be used if you're using it to apply formatting to whatever you're inserting.