GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-May-2004, 23:33
eRIC eRIC is offline
Awaiting Email Confirmation
 
Join Date: Nov 2003
Location: Kyrgyzstan
Posts: 31
eRIC is on a distinguished road

Problem Showing Images !!!!



Config.inc
PHP Code:

<?php
class DB {
   function DB() {
       $this->host = "localhost";
       $this->db = "convert";
       $this->user = "root";
       $this->pass = "some";
       $this->link = mysql_connect($this->host, $this->user, $this->pass);
       mysql_select_db($this->db);
       register_shutdown_function($this->close);
   }
   function close() {
       mysql_close($this->link);
   }
}
?>



Image.php
PHP Code:

<?
/*if(file_exists("config.inc")) /// From file
{
include("config.inc");
$DB_admin = new DB();
if($DB_admin==0)
{
print "<img src=\"./images/failed.gif\" border=\"0\" alt=\" Hata \">";
echo "<H2>Database Hatasi!</H2>\n";
echo mysql_errno().":  ".mysql_error()."<P>";
exit;
}
}
else
{
 print "<img src=\"./images/failed.gif\" border=\"0\" alt=\" Hata \">";
 echo "<H2>Config Hatasi!</H2>\n";
 echo "<H2>Config.inc dosyas? bulamadim, kontrol edin!</H2>\n";
}*/

mysql_connect("localhost","root","some"); // Normal
mysql_select_db("convert");

$id=$_GET["id"];
$sql = "SELECT * FROM image WHERE Id='$id'";
$result =mysql_query($sql);
if(!$result)
{
  echo "<H2>Hata!</H2>\n";
  echo mysql_errno().":  ".mysql_error()."<P>";
}
if (mysql_num_rows($result)>0) {
  $row = mysql_fetch_array ($result);
  $image_type = $row["image_type"];
  $image = $row["image"];
  Header("Content-type: $image_type");
  print $image;
}
mysql_close();
?>

if use connection like in normal it shows images, but if i use like above from file it doesn't show. it shows that image is sizexsize but no actual image.
in index.php
...........
..............
if ($_GET) {
$id = $_GET["id"];
Header("Location:./one.php");
print "<img src=\"image.php?id=$id\">";
...................


Where is problem?! Please help me.
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C I/O problem kelly80 C Programming Language 4 27-Apr-2004 21:15
Another FX 5600 problem (but with details that might shed light on this) BobDaDuck Computer Hardware Forum 2 16-Apr-2004 08:53
problem with php5 cgi installation fab13 Apache Web Server Forum 3 19-Nov-2003 10:11
unwanted scrollbar problem kelly001 Web Design Forum 3 24-Oct-2003 11:44
Why are my images distorted? rhino1616 Graphics Forum 0 27-Jun-2003 10:30

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 01:03.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.