<?php $conn = mysql_connect('localhost','root',''); if(!$conn){ die ("failed to connect with database" .mysql_error()); } $db = mysql_select_db('img_db',$conn); if(!$db){ die ("failed to connect with database".mysql_error()); } ?>