Thursday, October 4, 2012

Php Functions !

Below is a simple Function set up for Users. You can change this to whatever you like. The idea here is to get used to how they work. And later we will combine them into Classes.

function myFunction()        //WE NAME OUR FUNCTION// CAN BE      " select_user() "  //
  global $database_name, $link;     //THESE CAN BE BROUGHT IN BY INCLUDES WITHOUT//
  $retArr = array();

  mysql_select_db($database_name, $link);   //THIS CAN BE BROUGHT IN WITH INCLUDES ALSO/
  $query_queryLookup = "SELECT userId, userName, userFirst, userLast, userPw FROM users WHERE userId = '$id'";                    //AND HERE YOU MAY WANT TO USE $_SESSIONUSERID ETC///
  $queryLookup = mysql_query($query_queryLookup, $link) or die(__FUNCTION__.': '.mysql_error($link));
  $row_queryLookup = mysql_fetch_assoc($queryLookup);
  $totalRows_queryLookup = mysql_num_rows($queryLookup);

    do {
    } while ($row_queryLookup = mysql_fetch_assoc($queryLookup));


  return $retArr;                                             //OUR RETURNED VARIABLE//

} // end function myFunction()

No comments:

Post a Comment