I have been trying to access data from my local server using this php script, I am able to connect and able to get some information but other informaton wont display, only the description column displays nothing else.
Whats wrong with my code? Im using PHP 5.2.
Code:
<table>
<?php
if (!($db = mysqli_connect('localhost','taskforce','manage','t askforce'))) {
die('SQL ERROR: Connection failed: ' .mysqli_error($db));
}
?>
<h4>To Do List</h4>
<?php
$sql = 'SELECT description FROM tasks';
$result = mysqli_query($db, $sql) or die(mysqli_error());
$numRows = mysqli_num_rows($result);
?>
<table cellspacing="0">
<tr>
<th>Task ID</th>
<th>Task Title</th>
<th>Description</th>
<th>Link</th>
<th>Date Filed</th>
<th>Date Due</th>
<th>Priority</th>
</tr>
<?php
while ($row = mysqli_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $row['task_id']; ?></td>
<td><?php echo $row['title']; ?></td>
<td><?php echo $row['description']; ?></td>
<td><?php echo $row['link']; ?></td>
<td><?php echo $row['date_today']; ?></td>
<td><?php echo $row['date_due']; ?></td>
<td><?php echo $row['priority']; ?></td>
</tr>
<?php
};
mysqli_close($db);
?>
</table>
The only thing this displays is description ( and this is text) and the rest are either date, varchar, or int in the MySQL database