Working on a project as part of my final year, i need to get this to work quickly or i will flunk out of university!
What i need to do is get an image from a database and it to be placed on a specific location on the page. The variables used to call the image are x and y co-ordinates that are 'stored' in the url, they change with each click of the mouse and i need the image to change with them. i have attempted to do this myself using the below code:
<?
$x = $REQUEST['x'];
$y = $REQUEST['y'];
$db_name = 'localhost';
$table_name = 'Images';
$connection = @mysql_connect("localhost", "root", "*********") or die ("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection) or die ("Couldn't select Database.");
$query = "SELECT * FROM '$table_name' WHERE x = '$xid' AND y = '$yid'";
$result = mysql_query ($query);
while ($row = mysql_fetch_array($result)) {
$image = $row['image'];
}
?>
And then where the image should be i have: <IMG SRC="<? echo $image; ?>">
I'm sure this is me being an idiot but what can i say...i'm very new to php programing. Any help would be much appreciated!