Just coming to the end of a long day, and struggling with a function I've just written. I've done this loads of times before but can't work out what I've forgotten.
Basically I am running an SQL statement to return all the records, placing them in an array and returning them to the function.
When I call the function all I get is one row from the array back.
Function:
function File1(){ // Create drop down menu
//load database connection
include "config.php";
// Connect To MySQL Server
@mysql_connect($server, $username, $password) or die("Couldn't Connect to Database");
// Select Database
@mysql_select_db($database) or die(mysql_error());
// SQL query
$sql = "SELECT * FROM file;
// Execute SQL and exit if failure
$sql_result = mysql_query($sql) or die(mysql_error());
$num_rows = mysql_num_rows($sql_result);
$row = mysql_fetch_array($sql_result);
return $row;
#print_r($rows);
}
Call to Function:
$file = File1();