"; print_r($array); echo ""; } // for information on this function goto // http://www.icomtek.co.uk/2007/10/10/connect-to-a-mysql-database-using-php-with-error-reporting/ function mysql_conn($hostname, $username, $password, $database) { // connect to database server - if fail display message mysql_connect($hostname,$username,$password) or die("Sorry there has been a problem " . mysql_error()); // connect to the database - if fail display message mysql_select_db($database) or die("Sorry there has been a problem " . mysql_error()); } function query_array($query) { if (!$result = mysql_query($query)) { die("Sorry there has been a problem - " . mysql_error()); } else { while ($array = mysql_fetch_array($result,MYSQL_ASSOC)) { $return[] = $array; } return ($return); } } // sample use // database connection using the mysql_conn function mysql_conn($hostname, $username, $password, $database) // example use of query_array $query = query_array("SELECT * FROM table"); // display the results using printr function printr($query); ?>