Spraban9 Posted March 13, 2013 Share Posted March 13, 2013 <?php include("include/connection.php"); $catergory = $_POST['catergory']; $price= $_POST['price']; if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = "SELECT * FROM upload where catergory ='$catergory'and price = '$price'"; mysql_select_db('vas'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_assoc($retval)) { echo "TITLE :{$row['title']} <br> ". "CATERGORY : {$row['catergory']} <br> ". "DESCRIBION : {$row['des']} <br> ". "--------------------------------<br>". "CONTACT NO:{$row['phone']} <br> ". "ADDRESS : {$row['address']} <br> ". "CITY : {$row['city']} <br> ". "--------------------------------<br>". "POST DATE :{$row['postdate']} <br> ". "PRICE : {$row['price']} <br> ". "{$row['image']} <br> ". "--------------------------------<br>"; } mysql_free_result($retval); echo "Fetched data successfully\n"; mysql_close($conn); ?> hi friends i get this output for this coding, image not display . "TITLE :van sale CATERGORY : mp DESCRIBION : asssssssssswwwww -------------------------------- CONTACT NO:778485956 ADDRESS : kokuvil west, kokuvil CITY : colombo -------------------------------- POST DATE :2013-03-12 PRICE : 0 JFIFC !"$"$C" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4% &'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?;FN)`GJ_03{}k<?bΊY2˹B)eTa zUx^H\Ku vGTRVZԭՑXБk>+H!뷗Uo.> VB.~ly'{42/QelmݠC}i\G,xPk|Q^%EN8sFp8 °NS]40izRb櫪Oe <EIyOIS9qϷ0W*eOzZ`Ǟ8C"M/H\78NAswpG2z '" Quote Link to comment https://forums.phpfreaks.com/topic/275601-error-in-image-display-coding-for-database/ Share on other sites More sharing options...
Solution AyKay47 Posted March 13, 2013 Solution Share Posted March 13, 2013 The image is being stored as a BLOB, so you need to base64 encode it and insert it into an <img> tag: echo "<img src='data:image/jpeg;base64," . base64_encode($row['image']) . "' />"; Quote Link to comment https://forums.phpfreaks.com/topic/275601-error-in-image-display-coding-for-database/#findComment-1418392 Share on other sites More sharing options...
Spraban9 Posted March 13, 2013 Author Share Posted March 13, 2013 thank you friend Quote Link to comment https://forums.phpfreaks.com/topic/275601-error-in-image-display-coding-for-database/#findComment-1418398 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.