I'm new to PHP, so I'm not exactly sure how it works.
Anyway, I would line to return a multidimensional array to another method, essentially something storing a small amount of record and columns, table like structure.
I've written the following, no warning but no data either
public function GetData($sqlquery)
{
include 'config.php';
$result = mysql_query($sqlquery,$con);
$data = array();
while($row = mysql_fetch_assoc($result))
{
$data[] = $row;
}
return $data;
}
Most likely doing something stupid
Help appreciated.
EDIT:
Thanks for all the fast replies
I figured out why this wasn't working, I was addressing the array as such
print $data[0][0];
Rather than
print $data[0]['title'];
for example, thanks all :)
PS I really find it hard to believe you can't say $data[0][5], It's more logical IMO than specifying a string value for location