Loading ...
Sorry, an error occurred while loading the content.

RE: [phpXperts] Help with arrays

Expand Messages
  • mizanur rahman
    hi Keith i dont understand where are you getting $member array. your last script was assigning each value to individual variable. if that is the member class
    Message 1 of 7 , Aug 8, 2006
    • 0 Attachment
      hi Keith
       
      i dont understand where are you getting $member array. your last script was assigning each value to individual variable. if that is the member class then you call it this way
       
      $member = new member();
      $member->user_name;
       
      if you can send me the files then i can tell you what you need to do.
       
      thanks
      Mizan


      Keith R Edmiston <keith.edmiston@...> wrote:
      Mizan,
      Thank you.  I did try that earlier and still received a blank value back.  Is it possible then that the issue is in the way I’m trying to use the data in the calling module.  I’m using the following to send to my debug script where I’m echoing it.  Can you tell me if I’m doing it wrong, assuming my function has been modified as you suggest below?
      Database:          $user_name = $ row['user_ name'];
      Calling script:    $debug_field= $member[' user_name' ];
      Debug script:      <td><?php echo $debug_field ?></td>
      Thanks,
      -- Keith

      From: phpexperts@yahoogro ups.com [mailto:phpexperts@ yahoogroups. com] On Behalf Of mizanur rahman
      Sent: Tuesday, August 08, 2006 8:53 AM
      To: phpexperts@yahoogro ups.com
      Subject: Re: [phpXperts] Help with arrays
      hi Keith
      the problem you are facing is a very simple problem faced by all beginners. just remember one thing
      $anything implies a PHP variable.
      when you are using $ row[$user_ name];
      you are actually using an associative array either by index or by name. as far i guess you do not have defined
      $user_name. thats why it is not returning anything except empty string. you can do one thing if user_name is in the table then remove $ sign inside the array index. remove it from all the row index. that will be fine.
      a valid entry will be
      $user_name = $ row['user_ name'];
      I Hope this will solve your problem
      thanks
      Mizan


      Keith R Edmiston <keith.edmiston@ austin.utexas. edu> wrote:
      Hello,
      I’m relatively new to php and have been monitoring this list for a few weeks now.  I thank you all for allowing me to absorb the knowledge you have selfishly shared with others.
      I am admittedly having some difficulty learning how to use arrays within the php language.  Specifically, I’m attempting what would seem a very basic function in my database (MySQL) object that is aptly titled “get_member”.  Below is an excerpt of that function.  My question is how do I gain access and use the field values in the script that called this function?  It seems I keep coming up with blanks but I know there is data available in the table.
      Any and all help would be truly appreciated.
      ***CODE SNIPPET***** ********* ********* ********* ********* ********* ********* ********* ********* ********* ****
      $q = "SELECT * FROM ".TBL_MEMBER. " WHERE user_name=". $this->quote_smart( $user_name) ;
      $mysql_result= mysql_query( $q, $this->connection);
      if ($mysql_result= =False) {
           die('Error: ' . mysql_error( ));
           mysql_close( $this->connection);
           return(-2);
      }
      $num_rows = mysql_num_rows( $mysql_result) ;
      $row=mysql_fetch_ array($mysql_ result,MYSQL_ ASSOC);
      if ($row==True) {
           $user_name=$ row[$user_ name];
           $member_address_ 1=$row[$member_ address_1] ;
           $member_address_ 2=$row[$member_ address_2] ;
           $member_city= $row[$member_ city];
           $member_state= $row[$member_ state];
           $member_zipcode= $row[$member_ zipcode];
           $member_phone_ home=$row[ $member_phone_ home];
           $member_phone_ work=$row[ $member_phone_ work];
           $member_phone_ cell=$row[ $member_phone_ cell];
           $member_birth_ date=$row[ $member_birth_ date];
           $member_driver_ license_nbr= $row[$member_ driver_license_ nbr];
           $member_driver_ license_state= $row[$member_ driver_license_ state];
           $member_child_ 1_username= $row[$member_ child_1_username ];
           $member_child_ 2_username= $row[$member_ child_2_username ];
           $member_child_ 3_username= $row[$member_ child_3_username ];
           $member_child_ 4_username= $row[$member_ child_4_username ];
           $member_last_ update_username= $row[$member_ last_update_ username] ;
           $member_last_ update_timestamp =$row[$member_ last_update_ timestamp] ;
           $member_create_ timestamp= $row[$member_ create_timestamp ];
           mysql_close( $this->connection);
           return(1);
      } else {
           mysql_close( $mysql_link) ;
           return(0);
      }
      -- Keith
       

      Do you Yahoo!?
      Everyone is raving about the all-new Yahoo! Mail Beta.


      Do you Yahoo!?
      Get on board. You're invited to try the new Yahoo! Mail Beta.

    • Keith R Edmiston
      Mizan,I must apologize for the somewhat cryptic nature of the code snippets I ve previously included. The system I m working on has youth protection
      Message 2 of 7 , Aug 8, 2006
      • 0 Attachment

        Mizan,

         

        I must apologize for the somewhat cryptic nature of the code snippets I’ve previously included.  The system I’m working on has youth protection issues that result in me being somewhat closely-guarded.

         

        I’ve attached a text file (I hope the group list will pass that without stripping it) that has the full block of code in the calling module (register.php) and the resulting function in the database class (database.php).  You’ll notice that I’ve made some minor changes in the debugging of this problem that don’t look consistent, so please overlook that discretion.

         

        I certainly appreciate your help with this.  Up to now I’ve done a pretty fair job of self-teaching, but the syntax of gathering data back from functions still baffles me from time to time.

         

        Also, can you tell me if the “&” symbol serves a purpose in the arguments of the function (i.e. ,&$member_address_1,&$member_address_2…)?  I pulled that from some example code and haven’t been able to determine it’s worth.

         

        Thanks again for your time and help.

         

        -- Keith

         


        From: phpexperts@yahoogroups.com [mailto:phpexperts@yahoogroups.com] On Behalf Of mizanur rahman
        Sent: Tuesday, August 08, 2006 9:28 AM
        To: phpexperts@yahoogroups.com
        Subject: RE: [phpXperts] Help with arrays

         

        hi Keith

         

        i dont understand where are you getting $member array. your last script was assigning each value to individual variable. if that is the member class then you call it this way

         

        $member = new member();

        $member->user_name;

         

        if you can send me the files then i can tell you what you need to do.

         

        thanks

        Mizan



        Keith R Edmiston <keith.edmiston@ austin.utexas. edu> wrote:

        Mizan,

        Thank you.  I did try that earlier and still received a blank value back.  Is it possible then that the issue is in the way I’m trying to use the data in the calling module.  I’m using the following to send to my debug script where I’m echoing it.  Can you tell me if I’m doing it wrong, assuming my function has been modified as you suggest below?

        Database:          $user_name = $ row['user_ name'];

        Calling script:    $debug_field= $member[' user_name' ];

        Debug script:      <td><?php echo $debug_field ?></td>

        Thanks,

        -- Keith


        From: phpexperts@yahoogro ups.com [mailto:phpexperts@ yahoogroups. com] On Behalf Of mizanur rahman
        Sent: Tuesday, August 08, 2006 8:53 AM
        To: phpexperts@yahoogro ups.com
        Subject: Re: [phpXperts] Help with arrays

        hi Keith

        the problem you are facing is a very simple problem faced by all beginners. just remember one thing

        $anything implies a PHP variable.

        when you are using $ row[$user_ name];

        you are actually using an associative array either by index or by name. as far i guess you do not have defined

        $user_name. thats why it is not returning anything except empty string. you can do one thing if user_name is in the table then remove $ sign inside the array index. remove it from all the row index. that will be fine.

        a valid entry will be

        $user_name = $ row['user_ name'];

        I Hope this will solve your problem

        thanks

        Mizan



        Keith R Edmiston <keith.edmiston@ austin.utexas. edu> wrote:

        Hello,

        I’m relatively new to php and have been monitoring this list for a few weeks now.  I thank you all for allowing me to absorb the knowledge you have selfishly shared with others.

        I am admittedly having some difficulty learning how to use arrays within the php language.  Specifically, I’m attempting what would seem a very basic function in my database (MySQL) object that is aptly titled “get_member”.  Below is an excerpt of that function.  My question is how do I gain access and use the field values in the script that called this function?  It seems I keep coming up with blanks but I know there is data available in the table.

        Any and all help would be truly appreciated.

        ***CODE SNIPPET***** ********* ********* ********* ********* ********* ********* ********* ********* ********* ****

        $q = "SELECT * FROM ".TBL_MEMBER. " WHERE user_name=". $this->quote_smart( $user_name) ;

        $mysql_result= mysql_query( $q, $this->connection);

        if ($mysql_result= =False) {

             die('Error: ' . mysql_error( ));

             mysql_close( $this->connection);

             return(-2);

        }

        $num_rows = mysql_num_rows( $mysql_result) ;

        $row=mysql_fetch_ array($mysql_ result,MYSQL_ ASSOC);

        if ($row==True) {

             $user_name=$ row[$user_ name];

             $member_address_ 1=$row[$member_ address_1] ;

             $member_address_ 2=$row[$member_ address_2] ;

             $member_city= $row[$member_ city];

             $member_state= $row[$member_ state];

             $member_zipcode= $row[$member_ zipcode];

             $member_phone_ home=$row[ $member_phone_ home];

             $member_phone_ work=$row[ $member_phone_ work];

             $member_phone_ cell=$row[ $member_phone_ cell];

             $member_birth_ date=$row[ $member_birth_ date];

             $member_driver_ license_nbr= $row[$member_ driver_license_ nbr];

             $member_driver_ license_state= $row[$member_ driver_license_ state];

             $member_child_ 1_username= $row[$member_ child_1_username ];

             $member_child_ 2_username= $row[$member_ child_2_username ];

             $member_child_ 3_username= $row[$member_ child_3_username ];

             $member_child_ 4_username= $row[$member_ child_4_username ];

             $member_last_ update_username= $row[$member_ last_update_ username] ;

             $member_last_ update_timestamp =$row[$member_ last_update_ timestamp] ;

             $member_create_ timestamp= $row[$member_ create_timestamp ];

             mysql_close( $this->connection);

             return(1);

        } else {

             mysql_close( $mysql_link) ;

             return(0);

        }

        -- Keith

         


        Do you Yahoo!?
        Everyone is raving about the all-new Yahoo! Mail Beta.

         

         


        Do you Yahoo!?
        Get on board. You're invited to try the new Yahoo! Mail Beta.

      • mizanur rahman
        hi keith & sign stands for address of the variable, and it is used as call by reference in php. in call by reference actual value of the calling variable is
        Message 3 of 7 , Aug 8, 2006
        • 0 Attachment
          hi keith

          & sign stands for address of the variable, and it is used as call by reference in php. in call by reference actual value of the calling variable is changed. you can search online for "call by reference and call by value in php". that will clear you understanding. after anaylizing your code i think you are mistaking in one place


          your $member array is a simple array, it  is not an associative array. so your following code will not return anything. you index instead.
          $debug_field=$member['user_name'];


          change this to

          $debug_field=$member[0]; // cause user name is the first index of the array


          so you have use the index instead of the name. i hope that solves your problem

          let me know if anything is unclear or you are getting the same error again

          thanks
          Mizan



          Keith R Edmiston <keith.edmiston@...> wrote:
          Mizan,
           
          I must apologize for the somewhat cryptic nature of the code snippets I’ve previously included.  The system I’m working on has youth protection issues that result in me being somewhat closely-guarded.
           
          I’ve attached a text file (I hope the group list will pass that without stripping it) that has the full block of code in the calling module (register.php) and the resulting function in the database class (database.php) .  You’ll notice that I’ve made some minor changes in the debugging of this problem that don’t look consistent, so please overlook that discretion.
           
          I certainly appreciate your help with this.  Up to now I’ve done a pretty fair job of self-teaching, but the syntax of gathering data back from functions still baffles me from time to time.
           
          Also, can you tell me if the “&” symbol serves a purpose in the arguments of the function (i.e. ,&$member_address_ 1,&$member_address_ 2…)?  I pulled that from some example code and haven’t been able to determine it’s worth.
           
          Thanks again for your time and help.
           
          -- Keith
           

          From: phpexperts@yahoogro ups.com [mailto:phpexperts@ yahoogroups. com] On Behalf Of mizanur rahman
          Sent: Tuesday, August 08, 2006 9:28 AM
          To: phpexperts@yahoogro ups.com
          Subject: RE: [phpXperts] Help with arrays
           
          hi Keith
           
          i dont understand where are you getting $member array. your last script was assigning each value to individual variable. if that is the member class then you call it this way
           
          $member = new member();
          $member->user_name;
           
          if you can send me the files then i can tell you what you need to do.
           
          thanks
          Mizan


          Keith R Edmiston <keith.edmiston@ austin.utexas. edu> wrote:
          Mizan,
          Thank you.  I did try that earlier and still received a blank value back.  Is it possible then that the issue is in the way I’m trying to use the data in the calling module.  I’m using the following to send to my debug script where I’m echoing it.  Can you tell me if I’m doing it wrong, assuming my function has been modified as you suggest below?
          Database:          $user_name = $ row['user_ name'];
          Calling script:    $debug_field= $member[' user_name' ];
          Debug script:      <td><?php echo $debug_field ?></td>
          Thanks,
          -- Keith

          From: phpexperts@yahoogro ups.com [mailto:phpexperts@ yahoogroups. com] On Behalf Of mizanur rahman
          Sent: Tuesday, August 08, 2006 8:53 AM
          To: phpexperts@yahoogro ups.com
          Subject: Re: [phpXperts] Help with arrays
          hi Keith
          the problem you are facing is a very simple problem faced by all beginners. just remember one thing
          $anything implies a PHP variable.
          when you are using $ row[$user_ name];
          you are actually using an associative array either by index or by name. as far i guess you do not have defined
          $user_name. thats why it is not returning anything except empty string. you can do one thing if user_name is in the table then remove $ sign inside the array index. remove it from all the row index. that will be fine.
          a valid entry will be
          $user_name = $ row['user_ name'];
          I Hope this will solve your problem
          thanks
          Mizan


          Keith R Edmiston <keith.edmiston@ austin.utexas. edu> wrote:
          Hello,
          I’m relatively new to php and have been monitoring this list for a few weeks now.  I thank you all for allowing me to absorb the knowledge you have selfishly shared with others.
          I am admittedly having some difficulty learning how to use arrays within the php language.  Specifically, I’m attempting what would seem a very basic function in my database (MySQL) object that is aptly titled “get_member”.  Below is an excerpt of that function.  My question is how do I gain access and use the field values in the script that called this function?  It seems I keep coming up with blanks but I know there is data available in the table.
          Any and all help would be truly appreciated.
          ***CODE SNIPPET***** ********* ********* ********* ********* ********* ********* ********* ********* ********* ****
          $q = "SELECT * FROM ".TBL_MEMBER. " WHERE user_name=". $this->quote_smart( $user_name) ;
          $mysql_result= mysql_query( $q, $this->connection);
          if ($mysql_result= =False) {
               die('Error: ' . mysql_error( ));
               mysql_close( $this->connection);
               return(-2);
          }
          $num_rows = mysql_num_rows( $mysql_result) ;
          $row=mysql_fetch_ array($mysql_ result,MYSQL_ ASSOC);
          if ($row==True) {
               $user_name=$ row[$user_ name];
               $member_address_ 1=$row[$member_ address_1] ;
               $member_address_ 2=$row[$member_ address_2] ;
               $member_city= $row[$member_ city];
               $member_state= $row[$member_ state];
               $member_zipcode= $row[$member_ zipcode];
               $member_phone_ home=$row[ $member_phone_ home];
               $member_phone_ work=$row[ $member_phone_ work];
               $member_phone_ cell=$row[ $member_phone_ cell];
               $member_birth_ date=$row[ $member_birth_ date];
               $member_driver_ license_nbr= $row[$member_ driver_license_ nbr];
               $member_driver_ license_state= $row[$member_ driver_license_ state];
               $member_child_ 1_username= $row[$member_ child_1_username ];
               $member_child_ 2_username= $row[$member_ child_2_username ];
               $member_child_ 3_username= $row[$member_ child_3_username ];
               $member_child_ 4_username= $row[$member_ child_4_username ];
               $member_last_ update_username= $row[$member_ last_update_ username] ;
               $member_last_ update_timestamp =$row[$member_ last_update_ timestamp] ;
               $member_create_ timestamp= $row[$member_ create_timestamp ];
               mysql_close( $this->connection);
               return(1);
          } else {
               mysql_close( $mysql_link) ;
               return(0);
          }
          -- Keith
           

          Do you Yahoo!?
          Everyone is raving about the all-new Yahoo! Mail Beta.
           
           

          Do you Yahoo!?
          Get on board. You're invited to try the new Yahoo! Mail Beta.
          register.php
          ----------------------

          $member=array();
          $member=($database->get_member($slusername,$member_address_1,$member_address_2, $member_city,$member_state,$member_zipcode,$member_phone_home,$member_phone_work,
          $member_phone_cell,$member_birth_date,$member_driver_license_nbr,
          $member_driver_license_state,$member_BSA_member_nbr,$member_scout_1_username,
          $member_scout_2_username,$member_scout_3_username,$member_scout_4_username,
          $member_last_update_username,$member_last_update_timestamp,
          $member_create_timestamp,$num_rows)); {
          $username_scout[1]=$member[$member_scout_1_username];
          $username_scout[2]=$member[$member_scout_2_username];
          $username_scout[3]=$member[$member_scout_3_username];
          $username_scout[4]=$member[$member_scout_4_username];
          // D E B U G //
          $debug_field=$member['user_name'];
          // END DEBUG //
          }
          ?>

          **********************
          database.php
          ----------------------

          ////////////////////////////////////////////////////////////////////////////////////
          // get_member
          // Retrieves data for a specific member rec
          // Return:
          // 1 if found
          // 0 if not found
          // -1 username blank
          // -2 if database problem
          ////////////////////////////////////////////////////////////////////////////////////
          function get_member($user_name,&$member_address_1,&$member_address_2,&$member_city,
          &$member_state,&$member_zipcode,&$member_phone_home,&$member_phone_work,
          &$member_phone_cell,&$member_birth_date,&$member_driver_license_nbr,
          &$member_driver_license_state,&$member_BSA_member_nbr,&$member_scout_1_username,
          &$member_scout_2_username,&$member_scout_3_username,&$member_scout_4_username,
          &$member_last_update_username,&$member_last_update_timestamp,
          &$member_create_timestamp,&$num_rows){
          if ($user_name=="") {
          return(-1);
          }
          $q = "SELECT * FROM ".TBL_MEMBER." WHERE user_name=".$this->quote_smart($user_name);
          $mysql_result=mysql_query($q, $this->connection);
          if ($mysql_result==False) {
          die('Error: ' . mysql_error());
          mysql_close($this->connection);
          return(-2);
          }
          $num_rows = mysql_num_rows($mysql_result);
          $row=mysql_fetch_array($mysql_result,MYSQL_ASSOC);
          if ($row==True) {
          $user_name=$row['user_name'];
          $member_address_1=$row[$member_address_1];
          $member_address_2=$row[$member_address_2];
          $member_city=$row[$member_city];
          $member_state=$row[$member_state];
          $member_zipcode=$row[$member_zipcode];
          $member_phone_home=$row[$member_phone_home];
          $member_phone_work=$row[$member_phone_work];
          $member_phone_cell=$row[$member_phone_cell];
          $member_birth_date=$row[$member_birth_date];
          $member_driver_license_nbr=$row[$member_driver_license_nbr];
          $member_driver_license_state=$row[$member_driver_license_state];
          $member_BSA_member_nbr=$row[$member_BSA_member_nbr];
          $member_scout_1_username=$row[$member_scout_1_username];
          $member_scout_2_username=$row[$member_scout_2_username];
          $member_scout_3_username=$row[$member_scout_3_username];
          $member_scout_4_username=$row[$member_scout_4_username];
          $member_last_update_username=$row[$member_last_update_username];
          $member_last_update_timestamp=$row[$member_last_update_timestamp];
          $member_create_timestamp=$row[$member_create_timestamp];
          mysql_close($this->connection);
          return(1);
          } else {
          mysql_close($mysql_link);
          return(0);
          }
          }


          Do you Yahoo!?
          Everyone is raving about the all-new Yahoo! Mail Beta.

        • Keith R Edmiston
          Mizan, Thank you for your help. Once I took a look at the call by reference stuff you mentioned, and did a bit more reading on arrays, and staring at my
          Message 4 of 7 , Aug 8, 2006
          • 0 Attachment

            Mizan,

             

            Thank you for your help.  Once I took a look at the “call by reference” stuff you mentioned, and did a bit more reading on arrays, and staring at my code, I realized that I needed to simply label all the field definitions within the “$database->get_member” function with the standard you originally told me about ($array[‘fieldname’]) and all would be accessible in my calling script.

             

            Thanks again for your patience and help.

             

            -- Keith

             


            From: phpexperts@yahoogroups.com [mailto:phpexperts@yahoogroups.com] On Behalf Of mizanur rahman
            Sent: Tuesday, August 08, 2006 10:12 AM
            To: phpexperts@yahoogroups.com
            Subject: RE: [phpXperts] Help with arrays

             


            hi keith

            & sign stands for address of the variable, and it is used as call by reference in php. in call by reference actual value of the calling variable is changed. you can search online for "call by reference and call by value in php". that will clear you understanding. after anaylizing your code i think you are mistaking in one place


            your $member array is a simple array, it  is not an associative array. so your following code will not return anything. you index instead.

            $debug_field=$member['user_name'];


            change this to

            $debug_field=$member[0]; // cause user name is the first index of the array


            so you have use the index instead of the name. i hope that solves your problem

            let me know if anything is unclear or you are getting the same error again

            thanks
            Mizan



            Keith R Edmiston <keith.edmiston@...> wrote:

            Mizan,

             

            I must apologize for the somewhat cryptic nature of the code snippets I’ve previously included.  The system I’m working on has youth protection issues that result in me being somewhat closely-guarded.

             

            I’ve attached a text file (I hope the group list will pass that without stripping it) that has the full block of code in the calling module (register.php) and the resulting function in the database class (database.php).  You’ll notice that I’ve made some minor changes in the debugging of this problem that don’t look consistent, so please overlook that discretion.

             

            I certainly appreciate your help with this.  Up to now I’ve done a pretty fair job of self-teaching, but the syntax of gathering data back from functions still baffles me from time to time.

             

            Also, can you tell me if the “&” symbol serves a purpose in the arguments of the function (i.e. ,&$member_address_1,&$member_address_2…)?  I pulled that from some example code and haven’t been able to determine it’s worth.

             

            Thanks again for your time and help.

             

            -- Keith

             


            From: phpexperts@yahoogroups.com [mailto:phpexperts@yahoogroups.com] On Behalf Of mizanur rahman
            Sent: Tuesday, August 08, 2006 9:28 AM
            To: phpexperts@yahoogroups.com
            Subject: RE: [phpXperts] Help with arrays

             

            hi Keith

             

            i dont understand where are you getting $member array. your last script was assigning each value to individual variable. if that is the member class then you call it this way

             

            $member = new member();

            $member->user_name;

             

            if you can send me the files then i can tell you what you need to do.

             

            thanks

            Mizan



            Keith R Edmiston <keith.edmiston@...> wrote:

            Mizan,

            Thank you.  I did try that earlier and still received a blank value back.  Is it possible then that the issue is in the way I’m trying to use the data in the calling module.  I’m using the following to send to my debug script where I’m echoing it.  Can you tell me if I’m doing it wrong, assuming my function has been modified as you suggest below?

            Database:          $user_name = $row['user_name'];

            Calling script:    $debug_field=$member['user_name'];

            Debug script:      <td><?php echo $debug_field ?></td>

            Thanks,

            -- Keith


            From: phpexperts@yahoogroups.com [mailto:phpexperts@yahoogroups.com] On Behalf Of mizanur rahman
            Sent: Tuesday, August 08, 2006 8:53 AM
            To: phpexperts@yahoogroups.com
            Subject: Re: [phpXperts] Help with arrays

            hi Keith

            the problem you are facing is a very simple problem faced by all beginners. just remember one thing

            $anything implies a PHP variable.

            when you are using $row[$user_name];

            you are actually using an associative array either by index or by name. as far i guess you do not have defined

            $user_name. thats why it is not returning anything except empty string. you can do one thing if user_name is in the table then remove $ sign inside the array index. remove it from all the row index. that will be fine.

            a valid entry will be

            $user_name = $row['user_name'];

            I Hope this will solve your problem

            thanks

            Mizan



            Keith R Edmiston <keith.edmiston@...> wrote:

            Hello,

            I’m relatively new to php and have been monitoring this list for a few weeks now.  I thank you all for allowing me to absorb the knowledge you have selfishly shared with others.

            I am admittedly having some difficulty learning how to use arrays within the php language.  Specifically, I’m attempting what would seem a very basic function in my database (MySQL) object that is aptly titled “get_member”.  Below is an excerpt of that function.  My question is how do I gain access and use the field values in the script that called this function?  It seems I keep coming up with blanks but I know there is data available in the table.

            Any and all help would be truly appreciated.

            ***CODE SNIPPET******************************************************************************************

            $q = "SELECT * FROM ".TBL_MEMBER." WHERE user_name=".$this->quote_smart($user_name);

            $mysql_result=mysql_query($q, $this->connection);

            if ($mysql_result==False) {

                 die('Error: ' . mysql_error());

                 mysql_close($this->connection);

                 return(-2);

            }

            $num_rows = mysql_num_rows($mysql_result);

            $row=mysql_fetch_array($mysql_result,MYSQL_ASSOC);

            if ($row==True) {

                 $user_name=$row[$user_name];

                 $member_address_1=$row[$member_address_1];

                 $member_address_2=$row[$member_address_2];

                 $member_city=$row[$member_city];

                 $member_state=$row[$member_state];

                 $member_zipcode=$row[$member_zipcode];

                 $member_phone_home=$row[$member_phone_home];

                 $member_phone_work=$row[$member_phone_work];

                 $member_phone_cell=$row[$member_phone_cell];

                 $member_birth_date=$row[$member_birth_date];

                 $member_driver_license_nbr=$row[$member_driver_license_nbr];

                 $member_driver_license_state=$row[$member_driver_license_state];

                 $member_child_1_username=$row[$member_child_1_username];

                 $member_child_2_username=$row[$member_child_2_username];

                 $member_child_3_username=$row[$member_child_3_username];

                 $member_child_4_username=$row[$member_child_4_username];

                 $member_last_update_username=$row[$member_last_update_username];

                 $member_last_update_timestamp=$row[$member_last_update_timestamp];

                 $member_create_timestamp=$row[$member_create_timestamp];

                 mysql_close($this->connection);

                 return(1);

            } else {

                 mysql_close($mysql_link);

                 return(0);

            }

            -- Keith

             


            Do you Yahoo!?
            Everyone is raving about the all-new Yahoo! Mail Beta.

             

             


            Do you Yahoo!?
            Get on board. You're invited to try the new Yahoo! Mail Beta.

            register.php
            ----------------------

            $member=array();
            $member=($database->get_member($slusername,$member_address_1,$member_address_2, $member_city,$member_state,$member_zipcode,$member_phone_home,$member_phone_work,
            $member_phone_cell,$member_birth_date,$member_driver_license_nbr,
            $member_driver_license_state,$member_BSA_member_nbr,$member_scout_1_username,
            $member_scout_2_username,$member_scout_3_username,$member_scout_4_username,
            $member_last_update_username,$member_last_update_timestamp,
            $member_create_timestamp,$num_rows)); {
            $username_scout[1]=$member[$member_scout_1_username];
            $username_scout[2]=$member[$member_scout_2_username];
            $username_scout[3]=$member[$member_scout_3_username];
            $username_scout[4]=$member[$member_scout_4_username];
            // D E B U G //
            $debug_field=$member['user_name'];
            // END DEBUG //
            }
            ?>

            **********************
            database.php
            ----------------------

            ////////////////////////////////////////////////////////////////////////////////////
            // get_member
            // Retrieves data for a specific member rec
            // Return:
            // 1 if found
            // 0 if not found
            // -1 username blank
            // -2 if database problem
            ////////////////////////////////////////////////////////////////////////////////////
            function get_member($user_name,&$member_address_1,&$member_address_2,&$member_city,
            &$member_state,&$member_zipcode,&$member_phone_home,&$member_phone_work,
            &$member_phone_cell,&$member_birth_date,&$member_driver_license_nbr,
            &$member_driver_license_state,&$member_BSA_member_nbr,&$member_scout_1_username,
            &$member_scout_2_username,&$member_scout_3_username,&$member_scout_4_username,
            &$member_last_update_username,&$member_last_update_timestamp,
            &$member_create_timestamp,&$num_rows){
            if ($user_name=="") {
            return(-1);
            }
            $q = "SELECT * FROM ".TBL_MEMBER." WHERE user_name=".$this->quote_smart($user_name);
            $mysql_result=mysql_query($q, $this->connection);
            if ($mysql_result==False) {
            die('Error: ' . mysql_error());
            mysql_close($this->connection);
            return(-2);
            }
            $num_rows = mysql_num_rows($mysql_result);
            $row=mysql_fetch_array($mysql_result,MYSQL_ASSOC);
            if ($row==True) {
            $user_name=$row['user_name'];
            $member_address_1=$row[$member_address_1];
            $member_address_2=$row[$member_address_2];
            $member_city=$row[$member_city];
            $member_state=$row[$member_state];
            $member_zipcode=$row[$member_zipcode];
            $member_phone_home=$row[$member_phone_home];
            $member_phone_work=$row[$member_phone_work];
            $member_phone_cell=$row[$member_phone_cell];
            $member_birth_date=$row[$member_birth_date];
            $member_driver_license_nbr=$row[$member_driver_license_nbr];
            $member_driver_license_state=$row[$member_driver_license_state];
            $member_BSA_member_nbr=$row[$member_BSA_member_nbr];
            $member_scout_1_username=$row[$member_scout_1_username];
            $member_scout_2_username=$row[$member_scout_2_username];
            $member_scout_3_username=$row[$member_scout_3_username];
            $member_scout_4_username=$row[$member_scout_4_username];
            $member_last_update_username=$row[$member_last_update_username];
            $member_last_update_timestamp=$row[$member_last_update_timestamp];
            $member_create_timestamp=$row[$member_create_timestamp];
            mysql_close($this->connection);
            return(1);
            } else {
            mysql_close($mysql_link);
            return(0);
            }
            }

             

             


            Do you Yahoo!?
            Everyone is raving about the all-new Yahoo! Mail Beta.

          Your message has been successfully submitted and would be delivered to recipients shortly.