Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9064717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:19:28+00:00 2026-06-16T16:19:28+00:00

I am having following piece of code in my project: $start_time = $this->input->post(start_time); $a

  • 0

I am having following piece of code in my project:

$start_time = $this->input->post("start_time");
$a          = explode(":",$start_time);
$start_sec  = ($a[0]*3600)+($a[1]*60);
$end_sec    = $start_sec+5400;
$m          = ($end_sec/60);
$hrs        = (int)($m/60);
$mins       = ($m%60);
$sec        = "00";
$end_time   = $hrs.":".$mins.":".$sec;
$start_time .= ":".$sec;


$tablearr=array(
  "rest_id"        => $info['rest_id'],
  "rest_sec_id"    => $info['rest_sec_id'],
  "book_date"      => $this->input->post("date"),
  "book_start_time"=> $this->input->post("start_time"),
  "book_end_time"  => $end_time,
  "book_special"   => $this->input->post("purpose"),
  "book_cuisine"   => $this->input->post("cuisine"),
  "book_no_person" => $this->input->post("no_person"),
  "user_id"        => $this->session->userdata('member_id'),
  "book_is_menu"   => $this->input->post("menu"),
  "table_reserved" => $info['table_reserved']
);

$this->db->insert("b_rest_book",$tablearr);

This should insert single record of “Booking”. But insted the query inserting 5 records on execution: One record with all correct values and rest 4 records with null values.

The start time is entered by user and end time is calculated based on start time.

And after inserting the table Looks something like this :

book_id     rest_id     rest_sec_id     book_date   book_start_time     book_end_time   book_special    book_cuisine    book_no_person  user_id     book_is_menu    table_reserved  special_request

1   1   2   2012-12-23  07:00:00    08:30:00    2   2   2   2   No  1 

2   1   0   0000-00-00  00:00:00    01:30:00    0   0   0   2       1 

3   1   0   0000-00-00  00:00:00    01:30:00    0   0   0   2       1 

4   1   0   0000-00-00  00:00:00    01:30:00    0   0   0   2       1    
5   1   0   0000-00-00  00:00:00    01:30:00    0   0   0   

What exactly going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:19:29+00:00Added an answer on June 16, 2026 at 4:19 pm

    Try this:

    if($info['rest_sec_id'] != 0)
    {
       $this->db->insert("b_rest_book",$tablearr);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I'm having trouble with the following piece of code: <h:selectOneMenu id=selectTipoAutorizacion value=#{autorizacion.codigoTipoAutorizacion} required=true>
The following piece of code is a reduced sample from the large project I'm
I am having some trouble with a piece of code below: Input: li is
I am having a tough time understanding the following piece of code: int stride
Okay, I am having trouble with the following piece of code (in a header
I'm having some issues using the following code on user input: htmlentities($string, ENT_COMPAT, 'UTF-8');
I am having problems with a piece of code. I have this line in
I am having the following piece of code and i'm surprised that it's giving
I have the following piece of code - jsfiddle example The problem i'm having
I've having trouble to understand that following piece of code : [window setBackgroundColor:[NSColor colorWithPatternImage:[NSImage

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.