ensinger
06-26-2003, 09:11 PM
I need to assign values pulled by a select query to varibles, but the only thing I know how to do with the values I get from a select query is make a table. Below is the code that puts the values I need stored in variables in a table:
$query = "SELECT title, description, height, width FROM images WHERE filename = '$imagepath'";
$result = mysql_query($query)
or die (mysql_error());
echo "<TABLE BORDER=1>";
WHILE ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<tr>";
WHILE ( list ($key, $value) = each($row) )
{
echo "<TD>" . $value . "</TD>";
}
echo "</TR>";
}
echo "</TABLE>";
Its designed to call only one row so I just need the four values called in the query to have their own variable, could someone show me how to do this?
$query = "SELECT title, description, height, width FROM images WHERE filename = '$imagepath'";
$result = mysql_query($query)
or die (mysql_error());
echo "<TABLE BORDER=1>";
WHILE ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<tr>";
WHILE ( list ($key, $value) = each($row) )
{
echo "<TD>" . $value . "</TD>";
}
echo "</TR>";
}
echo "</TABLE>";
Its designed to call only one row so I just need the four values called in the query to have their own variable, could someone show me how to do this?