function help needed

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

    function help needed

    Hello Friends I need help in one function

    i want to get user info via id with function

    example first if i need just username i have to do is

    PHP Code:
    function username($id)
    {
    $query mysql_fetch_array(mysql_query("SELECT username FROM members WHERE id = '$id' ");
    $username $query[0];
    }

    $user_name username($id);
    echo 
    'hello $user_name'
    but i want to get multiple queries from it

    PHP Code:
    function userinfo($id)
    {
    $query mysql_fetch_array(mysql_query("SELECT * FROM members WHERE id = '$id' ");


    i want to di is get array from that function and show it like if username then select username query via function n show it then show gender and other stuff how will that work please help me ??
    ComputerForumz - Latest Tech News


    Mobbest.tk-Free Mobile Downloads

    #2
    No one to help ???
    ComputerForumz - Latest Tech News


    Mobbest.tk-Free Mobile Downloads

    Comment


      #3
      PHP Code:
      <?php

      function userinfo($id,$param)
      {

      $query mysql_fetch_array(mysql_query("SELECT * FROM members WHERE id = '$id' ");

      return 
      $query[''.$param.''];

      }  

      // print gender , id , name etc 
      echo userinfo($id,'gender');

      echo 
      userinfo($id,'name');

      echo 
      userinfo($id,'id');

      ?>
      This is ten percent luck, twenty percent skill
      Fifteen percent concentrated power of will
      Five percent pleasure, fifty percent pain

      And a hundred percent reason to remember the name!

      Comment


        #4
        Wow thanks just_m3 it worked thank you save alot my time
        ComputerForumz - Latest Tech News


        Mobbest.tk-Free Mobile Downloads

        Comment

        Working...
        X