Welcome Guest, Not a member yet? Register   Sign In
Need Help
#4

[eluser]parham90[/eluser]
I still did not clearly understand you. Do you mean to add the client to the client table, and then use its id and add it to the avail table along with the date entered in the form? If so, you can use the function alled $this->db->insert_id(). For example, let's say $data contains the form data. The phone and the email and such. And $date contains the date entered in the form. So,
Code:
$this->db->insert('client', $data); //add the client's data to the database.
$id = $this->db->insert_id(); //get the id of the last insert, which is the id of the client that we just
//added. This returns the id of the last row added by $this->db->insert();
$avail['date'] = $date;
$avail['client'] = $id;
$this->db->insert('avail', $avail); //add the client's id, along with the date, to the avail table.

Hope this one helped! Smile


Messages In This Thread
Need Help - by El Forum - 07-31-2010, 11:43 AM
Need Help - by El Forum - 07-31-2010, 12:38 PM
Need Help - by El Forum - 07-31-2010, 12:53 PM
Need Help - by El Forum - 07-31-2010, 01:00 PM
Need Help - by El Forum - 07-31-2010, 01:21 PM
Need Help - by El Forum - 08-01-2010, 02:45 PM
Need Help - by El Forum - 08-02-2010, 02:18 PM
Need Help - by El Forum - 08-02-2010, 02:31 PM
Need Help - by El Forum - 08-16-2010, 02:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB