Jump to content


Photo

IMAGE DISPLAYING FROM DATABASE


  • Please log in to reply
3 replies to this topic

#1 baber_abbasi

baber_abbasi
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts
  • LocationPakistan

Posted 26 May 2003 - 06:21 AM

I am using a script to display image from database. I want to display all images from my table onto the page. The code I am using is following and I will appreciate ur help if necessary modifications are made into it as required.

\"
$dbServer = \"localhost\";
$dbDatabase = \"blob\";
$dbUser = \"root\";
$dbPass = \"\";

$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die(\"Couldn\'t connect to database server\");

$dConn = mysql_select_db($dbDatabase, $sConn)
or die(\"Couldn\'t connect to database $dbDatabase\");

$result = mysql_query(\"SELECT * FROM myBlobs\");
if(mysql_num_rows($result) > 0)
{
$row = mysql_fetch_array($result);
do{

$dd = $row[\'blobData\'];
print($dd.\"<BR>\");
$row = mysql_fetch_array($result);
}while($row);

}else{echo\"No record\";}
\"

From above code, it displays only first image and don\'t increment to next which it should be. Please tell me how sould I resolve this problem.


Thankx
Baber N Abbasi

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 26 May 2003 - 12:41 PM

Try this :roll:

$result = mysql_query("SELECT * FROM myBlobs"); 



if(mysql_num_rows($result) > \'0\') 

{ 

    do{ 



              $dd = $row[\'blobData\']; 

               print($dd."<BR>"); 

                $row = mysql_fetch_array($result); 

         }while($row=mysql_fetch_array($result)); 



}else{echo"No record";}

Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 baber_abbasi

baber_abbasi
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts
  • LocationPakistan

Posted 26 May 2003 - 03:30 PM

Thankx for ur help.

I tried this but get same output thatis only forst image from table is displayed. Couldu plz check it again?

Thankx again.
Baber N Abbasi

#4 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 27 May 2003 - 03:38 AM

Hope thsi works :roll:

$result = mysql_query("SELECT * FROM myBlobs"); 



if(mysql_num_rows($result) > \'0\') 

{ 

    do{ 



              $dd = $row[\'blobData\']; 

               print($dd."<BR>"); 

        }while($row=mysql_fetch_array($result)); 



}else{echo"No record";}  

Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users