i could be wrong but your using a foreach for the second insert ? remove that foreach and where you entered the $value variables change them to the variables you declared, i believe you have already declared the last id and used it on pro_id, as i say i could be wrong but worh a look
thanks for the help.
I have some problems in insert to the second tabele2
all information:
$pro_alte_detalii = Input::get('pro_alte_detalii');
$pro_pachet_mini = Input::get('pro_pachet_mini');
$pro_pachet_mediu = Input::get('pro_pachet_mediu');
$pro_pachet_maxi = Input::get('pro_pachet_maxi');
$pro_tuns = Input::get('pro_tuns');
$pro_spalat = Input::get('pro_spalat');
$pro_uscat = Input::get('pro_uscat');
$pro_taiat_ungi = Input::get('pro_taiat_ungi');
$pro_curatat_urechi = Input::get('pro_curatat_urechi');
$pro_vidat = Input::get('pro_vidat');
$pro_pernute = Input::get('pro_pernute');
$pro_periat = Input::get('pro_periat');
$pro_parfumat = Input::get('pro_parfumat');
$pro_fundita = Input::get('pro_fundita');
is not in the first tabele, I like just to add to the tabele2 in the same submit.
and if I neet for update ? what I need to insert ? I need to updete first tabele and add all information add to the ferst tabele I like to insert in the tabele 2.
is not good, I change but same problem
Can you post a new paste or haste?
if(!empty($_POST['submit'])){
//Create an array of fields for your insert query
$fields = array(
'pr_nume_username' => Input::get('pr_nume_username'),
'pr_nume' => Input::get('pr_nume'),
'pr_telefon' => Input::get('pr_telefon') ,
'pr_animal_nume' => Input::get('pr_animal_nume'),
'pr_adaugat' => Input::get('pr_adaugat'),
'pr_data' => Input::get('pr_data'),
'pr_ora' => Input::get('pr_ora'),
'pr_kilograme' => Input::get('pr_kilograme'),
'pr_varsta' => Input::get('pr_varsta'),
'pr_sex' => Input::get('pr_sex'),
'pr_vacinat' => Input::get('pr_vacinat'),
'pr_detalii' => Input::get('pr_detalii')
);
$db->insert('propietar',$fields);
$newProId = $db->lastId();
// prepare sql and bind parameters
//Now they are being sanitized too!
//You really don't need to create a variable for each one unless
//you want to use it somewhere else on the page. You could just
//use Input::get down in the array below
$pro_id = Input::get('newProId');
$pro_nume = Input::get('pr_nume');
$pro_telefon = Input::get('pr_telefon');
$pro_animal_nume = Input::get('pr_animal_nume');
$pro_adaugat = Input::get('pr_adaugat');
$pro_data = Input::get('pr_data');
$pro_ora = Input::get('pr_ora');
$pro_vacinat = Input::get('pr_vacinat');
$pro_varsta = Input::get('pr_varsta');
$pro_kilograme = Input::get('pr_kilograme');
$pro_sex = Input::get('pr_sex');
$pro_alte_detalii = Input::get('pr_detalii');
$pro_pachet_mini = Input::get('pro_pachet_mini');
$pro_pachet_mediu = Input::get('pro_pachet_mediu');
$pro_pachet_maxi = Input::get('pro_pachet_maxi');
$pro_tuns = Input::get('pro_tuns');
$pro_spalat = Input::get('pro_spalat');
$pro_uscat = Input::get('pro_uscat');
$pro_taiat_ungi = Input::get('pro_taiat_ungi');
$pro_curatat_urechi = Input::get('pro_curatat_urechi');
$pro_vidat = Input::get('pro_vidat');
$pro_pernute = Input::get('pro_pernute');
$pro_periat = Input::get('pro_periat');
$pro_parfumat = Input::get('pro_parfumat');
$pro_fundita = Input::get('pro_fundita');
$pro_stele = Input::get('pro_stele');
$utilizatorr = Input::get('pr_nume_username');
>----------------THE PROBLEM IS HERE<-----------------
//Create an array of fields for your insert query
$fields2 = array(
'pro_id' => $newProId,
'pro_nume' => $pro_nume,
'pro_telefon' => $pro_telefon ,
'pro_animal_nume' => $pro_animal_nume,
'pro_adaugat' => $pro_adaugat,
'pro_data' => $pro_data,
'pro_ora' => $pro_ora,
'pro_vacinat' => $pro_vacinat,
'pro_varsta' => $pro_varsta,
'pro_kilograme' => $pro_kilograme,
'pro_sex' => $pro_sex,
'pro_alte_detalii' => $pro_alte_detalii,
'pro_pachet_mini' => $pro_pachet_mini, <-------------------
'pro_pachet_mediu' => $pro_pachet_mediu, <-------------------
'pro_pachet_maxi' => $pro_pachet_maxi, <-------------------
'pro_tuns' => $pro_tuns, <-------------------
'pro_spalat' => $pro_spalat, <-------------------
'pro_uscat' => $pro_uscat,<-------------------
'pro_taiat_ungi' => $pro_taiat_ungi,<-------------------
'pro_curatat_urechi' => $pro_curatat_urechi,<-------------------
'pro_vidat' => $pro_vidat,<-------------------
'pro_pernute' => $pro_pernute,<-------------------
'pro_periat' => $pro_periat,<-------------------
'pro_parfumat' => $pro_parfumat,<-------------------
'pro_fundita' => $pro_fundita,<-------------------
'pro_stele' => $pro_stele,
'id_key_sub' => $key,
'utilizatorr' => $utilizatorr
);
//Run the insert.
//to do an insert query, you only need to know what table and an array of fields. This creates, prepares, binds, and sanitizes your db update.
$db->insert('programare',$fields2);
//here is the id of the above query
//Put your sub queries down here...
header('Location: account.php');
}
Can you haste your whole scrip at hastebin.com - I need to see your checkboxes too so I can debug this...Also, remove your header from subqueries so we can know if there are any errors that we can't see because of the redirect...
When we put the redirect back in place, use Redirect::to('whatever.php'); instead of Header Location since this is handled from a UC function.