So, I’m trying to echo a table with php that will output mysql data. The problem is that I have variables within the table that arent getting shown because of “” and ‘’. What would be a better way to do this?
<?php
#This script is to view scholarships as an admin. You can edit the entries or delete them.
#admin_edit.php
#Address error handling. Tell us if there is an error.
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
#Connect and select the scholarship database.
if ($dbc = @mysql_connect ('localhost', 'root', 'sqldb')) {
if (!@mysql_select_db ('scholarships')) {
die ('<p>Could not select the database because: <b>' . mysql_error() . '</b></p>');
}
} else {
die ('<p>Could not connect to MySQL because: <b>' . mysql_error() . '</b></p>');
}
#Define the query
$query = 'SELECT * FROM scholarships ORDER BY org DESC';
#Run the query we defined
if ($r = mysql_query ($query)) {
#Retreive all records and print the records
while ($row = mysql_fetch_array ($r)) {
$title = $row['title'];
$org = $row['org'];
$description = $row['description'];
$eligibility = $row['eligibility'];
$decision = $row['decision'];
$minimum = $row['minimum'];
$maximum = $row['maximum'];
$deadline = $row['deadline'];
$contact = $row['contact'];
$address = $row['address'];
$phone = $row['phone'];
$email = $row['email'];
$site = $row['site'];
echo '<table width="600" border="0">
<tr>
<td colspan="3" bgcolor="#CC0000">$title</td>
<td bgcolor="#CC0000">$org</td>
</tr>
<tr>
<td colspan="2">Description</td>
<td width="189">Eiligibility:</td>
<td width="190">Desicion</td>
</tr>
<tr>
<td height="65" colspan="2">$description</td>
<td>$eligibility</td>
<td>$decision</td>
</tr>
<tr>
<td width="81">Minimum</td>
<td width="122">$minimum</td>
<td><div align="center">Deadline:</div></td>
<td><div align="center">Contact:</div></td>
</tr>
<tr>
<td>Maximum:</td>
<td>$maximum</td>
<td>$deadline</td>
<td>$contact</td>
</tr>
<tr>
<td colspan="2"><div align="center">Address:</div></td>
<td><div align="center">Phone Number:</div></td>
<td><div align="center">Email</div></td>
</tr>
<tr>
<td colspan="2">$address</td>
<td>$phone</td>
<td>$email</td>
</tr>
<tr>
<td colspan="4">$site</td>
</tr>
</table>
<p> </p>';
}
} else { #Query didn't run.
die ('<p>Could not retrieve data because: <b>' . mysql_error() . '</b></p>');
} #End of query IF.
mysql_close(); #Close the connection to MySQL
?>