blob type image
Posted: Sat Feb 25, 2012 6:07 am
whats up lads..im having problems with my project,i cant seem to view the image that is saved in mysql database..the data type is in blob..anyway here's the code that im currently working on..i hope someone can help me with my problem..thanks in advance..
<?php
include ('connection/conect.php');
include ('connection/session.php');
include ('header.php');
?>
<?php
$brand="Shampoo";
$prod = mysql_query ("SELECT * from products where ProdCategory= '$brand' ");
echo '<center><div style="color:#000;
font-family:Tahoma;
border:1px solid #CCC;
text-align:left;
font-family:Tahoma;
font-size:10pt;
margin-top:5px;
overflow-y:scroll;
width:100%;
height:50%" >
<table width="400" border="0" cellspacing="20" cellpadding="2" align="center">';
$colsPerRow = 3;
$i=0;
// width of each column in percent
$colWidth = (int)(100/$colsPerRow);
while ($row = mysql_fetch_assoc($prod)) { $id=$row['ProdID'];
if ($i % $colsPerRow == 0) {
// start a new row
echo '<tr> ';
}
$numImages = $row['ProdImage'] > 1 ?
$row['ProdImage'] . ' images'
: $row['ProdImage'] . ' image';
echo "<td width=' . $colWidth . '%>
<div id='demo-3' class='demobox'><a href='prodind.php?id=".$id."'> <img src=".$row['ProdName']." width='100' height='100' border='1px'> </b><h5></a>
<div class='details'>
<br><b> <div class=''><a href='prodind.php?id=".$id."'> ".$row['ProdName']."</b></a></div></div>
Php : ".$row['UnitPrice']." <br>
</div></div>
<br>
";
if ($i % $colsPerRow == $colsPerRow - 1) {
// end this row
echo '</tr>';
}
$i += 1;
}
echo '</table></div> ' ;
include ('footer.php');
?>
<?php
include ('connection/conect.php');
include ('connection/session.php');
include ('header.php');
?>
<?php
$brand="Shampoo";
$prod = mysql_query ("SELECT * from products where ProdCategory= '$brand' ");
echo '<center><div style="color:#000;
font-family:Tahoma;
border:1px solid #CCC;
text-align:left;
font-family:Tahoma;
font-size:10pt;
margin-top:5px;
overflow-y:scroll;
width:100%;
height:50%" >
<table width="400" border="0" cellspacing="20" cellpadding="2" align="center">';
$colsPerRow = 3;
$i=0;
// width of each column in percent
$colWidth = (int)(100/$colsPerRow);
while ($row = mysql_fetch_assoc($prod)) { $id=$row['ProdID'];
if ($i % $colsPerRow == 0) {
// start a new row
echo '<tr> ';
}
$numImages = $row['ProdImage'] > 1 ?
$row['ProdImage'] . ' images'
: $row['ProdImage'] . ' image';
echo "<td width=' . $colWidth . '%>
<div id='demo-3' class='demobox'><a href='prodind.php?id=".$id."'> <img src=".$row['ProdName']." width='100' height='100' border='1px'> </b><h5></a>
<div class='details'>
<br><b> <div class=''><a href='prodind.php?id=".$id."'> ".$row['ProdName']."</b></a></div></div>
Php : ".$row['UnitPrice']." <br>
</div></div>
<br>
";
if ($i % $colsPerRow == $colsPerRow - 1) {
// end this row
echo '</tr>';
}
$i += 1;
}
echo '</table></div> ' ;
include ('footer.php');
?>