Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //when I use......
- $found_user=User::find_user_by_id(2);
- echo $found_user['id'];
- //with
- public static function find_user_by_id ($id){
- $result_set= self::find_this_query("SELECT * FROM users WHERE id=$id");
- $found_user=mysqli_fetch_array($result_set);
- return $found_user;
- }
- //I get a result id returned
- //but when I use
- $found_user=User::find_user_by_id(2);
- $myUser=User::instantiate($found_user);
- echo $myUser->id;
- //with
- public static function instantiate($found_user){
- $the_object=new self;
- foreach ($found_user as $the_attribute => $value) {
- if($the_object->has_the_attribute($the_attribute)){
- $the_object->the_attribute=$value;
- }
- //I get a blank browser
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement