...

View Full Version : Returning mysql array values via function.



ag1060
08-27-2011, 09:46 PM
Hello,

I'm trying to return mysql values via function.

basically I have these two:

function create() {

$data=load_user();

echo $data[0]['uname'];
}



function load_user() {

$queryData[]="";
while($row = mysql_fetch_array($result)){

$queryData[]['uname']=$row[0];
$queryData[]['email']=$row[1];
}

return $queryData;

}

any help? Someone suggested me those code but it doesn't seem to work :(

-aaron

tangoforce
08-27-2011, 10:37 PM
You don't have a mysql query in there anywhere.

$result = mysql_query("select * from <tablename>");

Put that above your mysql_fetch_array line.

ag1060
08-27-2011, 11:44 PM
Ya I can't believe I missed something simple as that. Thanks tangoforce...everything's working smoothly :)

-aaron



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum