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 8898385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:36:09+00:00 2026-06-15T00:36:09+00:00

In a nutshell, I’m making a booking app. Booking id needs to start at

  • 0

In a nutshell, I’m making a booking app. Booking id needs to start at 10000 and increase by one each new booking.

I’ve started coding a method to generate this booking number. What I’m struggling with is:

  1. On first run, there will be no booking numbers so I can’t simply add 1 to the last id in the database table. I need a way to check if the last number does in fact have a base of 10000.

I’m using cake php and the way I’m getting the id number is using

$ids = $this->find('first', array('order' => 'Booking.id DESC', 'fields' => 'Booking.id'));

Any ideas?

  • 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-15T00:36:11+00:00Added an answer on June 15, 2026 at 12:36 am

    You could either re-create the Booking table or alter it so that the id field starts at 10000.

    Re-Create:

    DROP TABLE IF EXISTS Booking;
    CREATE TABLE IF NOT EXISTS Booking (
        id INT NOT NULL AUTO_INCREMENT,
        /* Other fields here */
        PRIMARY KEY (id)
    ) AUTO_INCREMENT = 10000;
    

    Or Alter:

    ALTER TABLE Booking AUTO_INCREMENT = 10000;
    

    You would only have to do this once. Afterward, you could be a lot more sure that the last Booking id was 10000 or greater.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a remote presentation tool in AS3. In a nutshell, one user (the
In a nutshell, the app looks up an instruction for something to do from
In a nutshell I'm writing a Symfony2 / Doctrine2 app and have installed and
In a nutshell, what I'm trying to do is create a new user, which
In a nutshell I have two images I want to overlay one over the
In a nutshell, to give you an example, I basically have an app with
In a nutshell My command line Java application copies data from one datasource to
In a nutshell, I'm writing an application that needs a BlockingQueue implementation that provides
In a nutshell: what sort of applications would be benefit most from the dashboard
In a nutshell what my program does is: it executes and takes user input

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.