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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.