[Solved] Valid use of the WHERE command
Posted: Thu Mar 26, 2009 7:51 pm
I've been googling and I can't figure it out but here's my code maybe you can help me out!
Any help? I haven't done PHP in a few years... Thanks for reading!
Code: Select all
<?php
if(isset($_SESSION['PoemID']))
{
if($_SESSION['PoemID'] > 0)
{
$dbh = mysql_connect("BLANK.com", "BLEEEP", "BLEEEP") or die("Unable to connect to MySQL.");
$selected = mysql_select_db("BLEEEEEP", $dbh) or die("Could not select Data-Base. Please report error to Web-Master!");
//Here's where I forget the command
$result = mysql_query("SELECT * FROM Poetry") or die(mysql_error());
while($row = mysql_fetch_array($result))
{
if($row['id'] == $_SESSION['PoemID'])
{
echo "<table border = 1 cellpadding = 4 cellspacing = 0 width = 100%>";
echo "<tr><td align = 'left' valign = 'top'>Title: </td><td align = 'left'> " . $row['title'] . " </td></tr>";
echo "<tr><td align = 'left' valign = 'top'>Poem:</td><td align = 'center'> " . $row['poem'] . "</td></tr>";
echo "<tr><td align = 'left' valign = 'top'>Author Note:</td><td align = 'left'> " . $row['meaning'] . "</td></tr>";
echo "</table>";
}
}
mysql_close($dbh);
}
}
?>