Displaying an image from MySql Db.
$db = mysqli_connect("localhost","root","","DbName");
$sql = "SELECT * FROM products WHERE id = $id";
$sth = $db->query($sql);
$result=mysqli_fetch_array($sth);
echo '<img src="data:image/jpeg;base64,'.base64_encode( $result['image'] ).'"/>';
More Related Contents:
- PHP DateTime supported formats
- Can I call a PHP function in a JavaScript click handler?
- How to create a chat program using php and mysqli for chatting [closed]
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE `id` [closed]
- Can I store images in MySQL [duplicate]
- MySQL – This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery
- PHP PDOException: “SQLSTATE[HY093]: Invalid parameter number”
- Insert multiple rows with one query MySQL
- Why is using a mysql prepared statement more secure than using the common escape functions?
- MySQL Join two tables with comma separated values
- localhost vs. 127.0.0.1 in mysql_connect()
- “slash before every quote” problem [duplicate]
- iPhone emoticons insert into MySQL but become blank value
- Inserting into MySQL from PHP (jQuery/AJAX)
- PDOstatement (MySQL): inserting value 0 into a bit(1) field results in 1 written in table
- Selecting all columns that start with XXX using a wildcard?
- How to delete mysql row after time passes?
- Echo menu tree with recursive function
- How to select multiple rows from mysql with one query and use them in php
- php run once and insert twice in mysql database
- Connect DATABASE Error TYPE: 2002: Permission denied
- Laravel nested relationships
- getting the value of an extra pivot table column laravel
- php sample script for pagination [closed]
- How to select rows where column value IS NOT NULL using CodeIgniter’s ActiveRecord?
- When should I close a database connection in PHP?
- Backup a mysql database and download as a file
- Is a BLOB converted using the current/default charset in MySQL?
- php connection pooling mysql [duplicate]
- PHP/MySQL Pagination