----- Original Message ----- 
From: "raquibul islam"
> Output
> 
> Found 'image' database
> Attempting to create new 'images' table
> 
> Table 'images' already exists (with 5 items)

I just wanted to see if you had actually created a database with a table in it, 
and it had something in it.

This should be your "image.php" file:

<?php#
if (isset($_GET['i']))#
{#
  $dbhost = 'localhost';#
  $dbuser = 'root';#
  $dbpass = '123456';#
  $dbname = 'image';#
  $tbl_name = 'images';#
#
  mysql_connect($dbhost, $dbuser, $dbpass) or die("Error: Cannot find 
database");#
  mysql_select_db($dbname) or die("Error: Cannot select database");#
  #
  $query = "SELECT image, image_type FROM $tbl_name WHERE image_id=" . 
$_GET['i'];#
  if ($query_result = mysql_query($query))#
  {#
    $image = mysql_fetch_array($query_result);#
    header("Content-type: $image[1]");#
    echo $image[0];#
  }#
  mysql_close();#
}#
#
?>#

Do a global search and replace to remove the "#" as these are the line ending!
If the lines wrap at any place other than these, join the lines back up again.

And this should be your index.php file:

<html>
<head>
<title>Display An Image</title>
</head>
<body>
<img src="image.php?i=1">
</body>
</html>

I've just tried it in PHP4 and PHP5 and it works on my computer without a hitch.
Try saving these 2 files again, and try it.
Delete the "images" table, but not the "image" database.
(Names are too much alike, and there is a variable called "image" but it 
doesn't matter for the moment).
Run the "create_table.php" I just sent, which will recreate the table, them 
upload a new image to the database and try it.

If it doesn't work, I'll email a zipped folder with the files in it to you.
Regards, Bob.


Reply via email to