Hi,
I'm trying to retrieve and display data from a DB.
<? // start the session
session_start();
header("Cache-control: private"); //IE 6 Fix
// Asign session variables
$cd_title = $_POST['cd_title'];
$artist = $_POST['artist'];
?>
<table width="100%" border="0" cellpadding="5">
<tr>
<td width="41%">Welcome <? echo $_SESSION['username']; ?></td>
<td width="59%"><div align="right"></div></td>
</tr>
<tr>
<td height="29"><a href="index.php">Home</a> : <a href="logout.php"> Log-out</a></td>
<td><div align="right"></div></td>
</tr>
</table><table width="100%" border="0" cellpadding="5">
<tr>
<td>
<?
echo "Edit Tracks On $cd_title";
echo " by $artist";
?></td>
</tr>
</table>
<table width='400' border="1" cellpadding='5' cellspacing='1' bordercolor="#FFFFFF">
<tr>
<td bordercolor="#CCCCCC" bgcolor='#E2E2E2'>Track</td>
<td> </td>
</tr>
<tr>
<tr>
<td width='75%' bordercolor="#CCCCCC" bgcolor='#F4F4F4'><table width="100%">
<tr>
<?
include "db.php";
// Adslashes to cencel out possible input of " " ''
addslashes($artist);
$sql = "SELECT * FROM `cds` WHERE `artist` = '$artist'";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "<h4 align=center>Could not find any track's by ".$artist."!</h4>";
exit;
}
while ($row = mysql_fetch_array($result)) {
extract($row);
echo "<td>".$track_num."</td>";
echo "<td>".$track_title."</td>";
}
mysql_free_result($result);
mysql_close($conn); ?>
</tr>
</table> </td>
<td width='25%' height="17" bordercolor="#CCCCCC" bgcolor='#F4F4F4'> </td>
</tr>
</table>
Its not outputting anthing from the db. I know the $artist variable is set correctly becouse I echo'd it at the top of the page.