Web Analytics Made Easy -
StatCounter Returning mysql array values via function. - CodingForum

Announcement

Collapse
No announcement yet.

Returning mysql array values via function.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Returning mysql array values via function.

    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

  • #2
    You don't have a mysql query in there anywhere.

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

    Put that above your mysql_fetch_array line.
    "Tango says double quotes with a single ( ' ) quote in the middle"
    '$Name says single quotes with a double ( " ) quote in the middle'
    "Tango says double quotes ( \" ) must escape a double quote"
    '$Name single quotes ( \' ) must escape a single quote'

    Comment


    • #3
      Ya I can't believe I missed something simple as that. Thanks tangoforce...everything's working smoothly

      -aaron

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎