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

[eluser]kre8ivdesigns[/eluser]
I am new to MySql and trying to build a database for a beach house for my cousin. She is renting it out and needs an availability script. What I have done so far is built a form that asks for basic client information that is stored in client table. The dates they choose is stored in avail table. What I need help with is how to link the dates to the client so I can recall the dates later for that client. If there is a simpler way to do this please let me know.

Table avail = id, dates, client
Table client = id, firstname, lastname, email, phone, begindate, numberdays

Code:
//input new client
        $u = new Client();
        $u->firstname = $this->input->post('firstname');
        $u->lastname = $this->input->post('lastname');
        $u->email = $this->input->post('email');
        $u->phone = $this->input->post('phone');
        $u->begindate = $this->input->post('begindate');
        $u->numberdays = $this->input->post('numberdays');
        $u->save();    
        
        
        //input dates to book
        $date = $this->input->post('begindate');
        $days = $this->input->post('numberdays');
        
        $i = 1;
        while ($i<$days) {        
            $newdates = strtotime('+'.$i.' day', strtotime($date));
            $booking[$i] = date('Y-m-d', $newdates);
            $individualdate = $booking[$i];
            
        
            //update individual
            $u = new Avail();
            $u->bookdate = $individualdate;
            $u->save();    
            ++$i;
        }


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