Jump to content

saving property values in an an object


narjis

Recommended Posts

I want to save class property values and want to write these in the database after being called from another function.

class model{
public $dbh;
public $user_arr=array('username','password','email','location','interest','homepage');
public function insert_data()
{

$sql = "INSERT INTO account VALUES ('" .$user_info['username']."','".$user_info['password'] 
      ."','".$user_info['email']."', 'user','".$user_info['location']."','".$user_info['interests']
      ."','".$user_info['homepage']."')";
      //if(isset($data)) 
      echo $sql;    
}
public function data_approoved($user){
//$user_info = new array();
$user_arr['username'] = $user['username'];
$user_arr['password'] = $user['password'];
$user_arr['email'] = $user['email'];
$user_arr['location'] = $user['location'];
$user_info['interests'] = $user['interests'];
$user_info['homepage'] = $user['homepage'];
Model::insert_data();
}
}
}//class ended

The approoved_data function is supposed to set the values of $user_info array which should be later on stored in database.

Please somebody help me.

Link to comment
https://forums.phpfreaks.com/topic/229482-saving-property-values-in-an-an-object/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.