I am origination a website and i have a duty to register clients, and i
need to place an choice to select from a database on a dropdown and
afterwards it is sent to a users table, i am removing 2 erros atm and i
can't find a solution.This is my Model:class Home extends CI_Model{//SQL
duty get_prodTYPE(){
$this->db->select()->from('producttype')->where('active',1);
$query=$this->db->get(); relapse $query->result_array(); }
duty get_COUNTRY(){ $this->db->select()->from('pais');
$this->db->order_by("id_pais", "asc"); $result =
$this->db->get('pais'); $resultado = array();
if($result->num_rows() > 0){ $resultado[''] = 'please select';
foreach($result->result_array() as $row){
$resultado[$row['id_pais']] = $row['Pais']; } }
relapse $resultado; }Then i have a large record where this is a sure
partial for registeringThis is my Controller:function register(){
if(!$this->session->userdata('userID')){
$data['prodTYPE']=$this->home->get_prodTYPE();
$data['info']=$this->home->get_info();
$data['country']=$this->home->get_COUNTRY(); //validacao
$config=array( array(
'field'=>'username', 'label'=>'Username',
'rules'=>'trim|required|is_unique[users.username]|callback_min_lenght_3'
), array(
'field'=>'password', 'label'=>'Password',
'rules'=>'trim|required|callback_min_lenght_6' ),
array( 'field'=>'password2',
'label'=>'Password de Confirmação',
'rules'=>'trim|required|matches[password]' ),
array( 'field'=>'email',
'label'=>'Email',
'rules'=>'trim|required|is_unique[users.email]|valid_email'
), array( 'field'=>'name',
'label'=>'Nome',
'rules'=>'trim|required|callback_username_check|callback_min_lenght_3'
), array( 'field'=>'contact',
'label'=>'Contacto',
'rules'=>'trim|required|numeric|callback_min_lenght_9' ),
array( 'field'=>'address',
'label'=>'Morada',
'rules'=>'trim|required|callback_adress_check|callback_min_lenght_9'
), array(
'field'=>'postalCODE', 'label'=>'Codigo Postal',
'rules'=>'trim|required|numeric]|callback_min_lenght_4'
), array(
'field'=>'postalCODE2', 'label'=>'Codigo Postal',
'rules'=>'trim|required|numeric|callback_min_lenght_3'
), array( 'field'=>'city',
'label'=>'Localidade',
'rules'=>'trim|required|callback_min_lenght_3|callback_city_check'
), array(
'field'=>'taxpayerNUMBER', 'label'=>'N.º Contribuinte',
'rules'=>'trim|required|numeric|callback_min_lenght_9'
), );
$this->form_validation->set_rules($config);
if($this->form_validation->run() == FALSE){//erro
$data['errors']=validation_errors(); } else {//registo
$data=array( 'username'=>$_POST['username'],
'userTYPE'=>'user',
'password'=>sha1($_POST['password']),
'email'=>$_POST['email'],
'active'=>$_POST['newsletter']==null?0:1,
'name'=>$_POST['name'], 'contact'=>$_POST['contact'],
'country'=>$_POST['country'],
'address'=>$_POST['address'],
'postalCODE'=>$_POST['postalCODE'],
'postalCODE2'=>$_POST['postalCODE2'],
'city'=>$_POST['city'],
'taxpayerNUMBER'=>$_POST['taxpayerNUMBER']
); $userid = $this->user->create_user($data);
$data_init=array( 'userID'=>$userid['userID'],
'situation'=>0 );
$this->user->init_shop($data_init);//comecar encomendas
$this->session->set_userdata('userID',$userid['userID']);
$this->session->set_userdata('userTYPE',$userid['userTYPE']);//userTYPE
$this->session->set_userdata('userNAME',$userid['username']);
$this->session->set_userdata('newsletter',$_POST['newsletter']==null?0:1);
redirect(base_url().'/index.php/emails/email_to/'.$userid['userID']);
} $data['page']="#fragment-3";
$this->load->view('header',$data);
$this->load->view('login',$data); $this->load->view('footer');
} else { redirect(base_url().'/index.php/'); }}Finnaly
i have a View:
Brent
Tuesday, 8 April 2014
Friday, 4 April 2014
How do tell if a Activity state has been damaged and needs to be recreated
I have a list activity that does a common list activity form stuff. All of
a activity setup was being finished in a onCreate()
method@Overrideprotected vacant onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_streams);
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
mActionBar = getActionBar(); mStreamListAdapter = new
StreamListRowAdapter(this, R.layout.stream_list_row); mStreamListView
= (ListView)findViewById(android.R.id.list);
mStreamListView.setAdapter(mStreamListAdapter);}I do not have onStart()
and onResume() overrides. we can successfully navigate out of this
activity formed on a menu buttons pulpy and afterwards navigate behind to
this activity. When we navigate divided from this list activity around
startActivity(newIntent), we do not call finish, though we do call finish
in a newIntent activity, when opening behind to this list activity.
Everything works fine, unless presumably a ListActivity itself or one of a
new Activities have been sitting in a credentials for a prolonged time
(i.e. we switched to another app). Long time is totalled in hours.
Sometimes (NOT always), when we come behind to my app after this delay, a
list activity does not arrangement a list, a menu is not displayed either,
only a vacant shade with a activity due displayed in a ActionBar. we
comprehend that we need to hoop opening behind to a list Activity around
onResume() (and maybe onStart()). But onResume() is always called after we
navigate behind to this list activity, how do we unequivocally know if a
variables representing a ListAdapter and ListView have indeed been damaged
by a OS and need to be recreated inside onResume(), we don't wish to
reconstruct them each time onResume() is called. Can we only check to see
if they are equal to null? It's tough to exam this, as this does not occur
unequivocally regularly.Thank You,Gary
a activity setup was being finished in a onCreate()
method@Overrideprotected vacant onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_streams);
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
mActionBar = getActionBar(); mStreamListAdapter = new
StreamListRowAdapter(this, R.layout.stream_list_row); mStreamListView
= (ListView)findViewById(android.R.id.list);
mStreamListView.setAdapter(mStreamListAdapter);}I do not have onStart()
and onResume() overrides. we can successfully navigate out of this
activity formed on a menu buttons pulpy and afterwards navigate behind to
this activity. When we navigate divided from this list activity around
startActivity(newIntent), we do not call finish, though we do call finish
in a newIntent activity, when opening behind to this list activity.
Everything works fine, unless presumably a ListActivity itself or one of a
new Activities have been sitting in a credentials for a prolonged time
(i.e. we switched to another app). Long time is totalled in hours.
Sometimes (NOT always), when we come behind to my app after this delay, a
list activity does not arrangement a list, a menu is not displayed either,
only a vacant shade with a activity due displayed in a ActionBar. we
comprehend that we need to hoop opening behind to a list Activity around
onResume() (and maybe onStart()). But onResume() is always called after we
navigate behind to this list activity, how do we unequivocally know if a
variables representing a ListAdapter and ListView have indeed been damaged
by a OS and need to be recreated inside onResume(), we don't wish to
reconstruct them each time onResume() is called. Can we only check to see
if they are equal to null? It's tough to exam this, as this does not occur
unequivocally regularly.Thank You,Gary
Tuesday, 1 April 2014
How to get a list of all tags while controlling a gem 'acts-as-taggable-on' in Rails (not a counts)
I have set a acts-as-taggable-on gem in my denote like this :
acts_as_taggable_on :deshanatagsIt use a context deshanatags. Now we need
to get a list of all a tags (not wholly a ones indifferent for one item.
we need everything) in this context in a following format :[
{"id":"856","name":"House"}, {"id":"1035","name":"Desperate
Housewives"}]How can we do this?I attempted to follow many tutorials
though strike passed ends since many of them are combined for Rails 3.
Rails for have some changes to a denote like dismissal of attr_accessor
that make it challenging for me to know those tutorials. So greatfully
help.Simply im perplexing to supplement Jquery Token quarrel
(http://loopj.com/jquery-tokeninput/) to my appPS : Through Tagging table,
is there a proceed to get a list of tags like a cost of Tag.all by
filtering a context?
acts_as_taggable_on :deshanatagsIt use a context deshanatags. Now we need
to get a list of all a tags (not wholly a ones indifferent for one item.
we need everything) in this context in a following format :[
{"id":"856","name":"House"}, {"id":"1035","name":"Desperate
Housewives"}]How can we do this?I attempted to follow many tutorials
though strike passed ends since many of them are combined for Rails 3.
Rails for have some changes to a denote like dismissal of attr_accessor
that make it challenging for me to know those tutorials. So greatfully
help.Simply im perplexing to supplement Jquery Token quarrel
(http://loopj.com/jquery-tokeninput/) to my appPS : Through Tagging table,
is there a proceed to get a list of tags like a cost of Tag.all by
filtering a context?
Subscribe to:
Comments (Atom)