I have been having a go and came up with the following code but it only displays the one record and no others where as it should display 4
Code:
echo "<td><img src=images/" . $row['indexed'] == 'Yes' ? 'green-check.png' : 'red-cross.png' . "></td>";
below is the whole code I have
Code:
<?php
// connect to the database
include('dbfilename.php');
// get the records from the database
if ($result = $mysqli->query("SELECT website_id, category, url, DATE_FORMAT(domain_expiry_date, '%d/%m/%Y') AS domain_expiry_date, site_login_url, site_username_login, site_password_login, no_of_posts, da, tf, ct, domain_name_owner, DATE_FORMAT(domain_owner_dob, '%d/%m/%Y') AS domain_owner_dob, domain_owner_address, domain_owner_email, domain_owner_phone, email_account, email_account_url, email_account_address, email_username, email_password, registrar, registrar_url, registrar_username, registrar_password, hosting_company, hosting_url, hosting_username, hosting_password, DATE_FORMAT(hosting_expiry_date, '%d/%m/%Y') AS hosting_expiry_date, hosting_cpanel_url, hosting_cpanel_username, hosting_cpanel_password, sites_linked_out_to, DATE_FORMAT(last_post_date, '%d/%m/%Y') AS last_post_date, indexed FROM websites ORDER BY website_id"))
{
// display records if there are records to display
if ($result->num_rows > 0)
{
// display records in a table
echo "<table class='records'>";
// set table headers
echo "<tr>
<th>Website ID</th>
<th>Category</th>
<th>URL</th>
<th>DA</th>
<th>TF</th>
<th>CT</th>
<th>No Of Posts</th>
<th>Last Post Date</th>
<th>Indexed</th>
<th colspan='2'>Actions</th>
</tr>";
while ($row = $result->fetch_object())
{
// set up a row for each record
echo "<tr>";
echo "<td><a href='view-specific-website-data.php?id=" . $row->website_id . "'>".$row->website_id . "</a></td>";
echo "<td>" . $row->category . "</td>";
echo "<td><a href='http://" . $row->url . "' target='_blank'>" . $row->url . "</a></td>";
echo "<td>" . $row->da . "</td>";
echo "<td>" . $row->tf . "</td>";
echo "<td>" . $row->ct . "</td>";
echo "<td>" . $row->no_of_posts . "</td>";
echo "<td>" . $row->last_post_date . "</td>";
echo "<td><img src=images/" . $row['indexed'] == 'Yes' ? 'green-check.png' : 'red-cross.png' . "></td>";
echo "<td><a href='add-update-website-data.php?website_id=" . $row->website_id . "'>Edit</a></td>";
echo "<td><a href='delete.php?website_id=" . $row->website_id . "'>Delete</a></td>";
echo "</tr>";
}
echo "</table>";
}
// if there are no records in the database, display an alert message
else
{
echo "No results to display!";
}
}
// show an error if there is an issue with the database query
else
{
echo "Error: " . $mysqli->error;
}
// close database connection
$mysqli->close();
?>
At least I am not getting any errors, any help or point me in the right direction would be really appreciated
Bookmarks