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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:00:30+00:00 2026-06-14T10:00:30+00:00

I’m trying to generate a value, not on database-side like auto key stuff, but

  • 0

I’m trying to generate a value, not on database-side like auto key stuff, but on the front end or on the client side.. Do you have any clever idea to do that? Because Booking ref is not my primary key, it can’t be autogenerated. What I want to do is to have an initial value of 10307 then increment it, whenever user/s create/s new record.

But what I’ve tried so far is this in PHP:

private function inputBookingRef() {
    $value = $this->bookingRef;
    $html = "";
    $value = 10307;
    $value++;
    $html .= '<label for="ref">Booking Ref: </label>';
    $html .= HTML::inputText("ref", 20, $value) . PHP_EOL;
    return $html;
}

NOTE:
My initial value is 10307, then I use the increment operator to make it 10308. But every time I create another record it just gives 10308. I think there must be some clever way to make it increment.

Any help is welcome. Thanks.

  • 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-14T10:00:31+00:00Added an answer on June 14, 2026 at 10:00 am

    Since you are saving the value in db, you just have to fetch the value from database and pass that value to your function, so everytime it will be incrementing your previous value.

    $query = mysql_query("SELECT MAX(ref_id) FROM table ORDER BY id DESC LIMIT 1");//Getting the max ref_id
    $values = mysql_fetch_assoc($query);
    inputBookingRef($values['ref_id'])//calling the function
    
    private function inputBookingRef($value) {
        //$value = $this->bookingRef;
        $html = "";
        //$value = 10307;
        $value++;
        $html .= '<label for="ref">Booking Ref: </label>';
        $html .= HTML::inputText("ref", 20, $value) . PHP_EOL;
        return $html;
    }
    

    And fnally Insert the new $value into the Db

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace

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.