NextIndexPrevious

Programs in PHP

22. Program to Read image from Database.
<?php
	
	header("content-type:image/jpeg");
		
	mysql_connect("servername","username","password");
	mysql_select_db("databasename");
	$sql = "select * from tablename";
	$data = mysql_query($sql);
		
	while($rec=mysql_fetch_row($data))
	{
		echo "$rec[1]<br>";
	}
	
?>

-------------------------------------------------------------
Note: When we using XAMPP or WAMP,
servername = localhost, username = root, password is empty.

Father of PHP

Rasmus Lerdorf

Rasmus Lerdorf

Born: November 22, 1968, Greenland
Google+