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 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

Tanya HostSinimo

Tanya HostSinimo Logo Tanya HostSinimo Logo

Tanya HostSinimo Navigation

  • Home
  • Web Hosting
  • SEO Checker
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Terms of Use
  • Privacy Policy
  • Cookie Policy
Home/ Questions/Q 415
In Process
fadaman
  • 0
fadamanTeacher
Asked: April 21, 20212021-04-21T14:41:01+08:00 2021-04-21T14:41:01+08:00In: CFM Language

HOW TO GET LAST INSERT AUTO INCREMENT VALUE FOR MYSQL IN COLDFUSION

  • 0

How to get last value when you make insert query for mysql in coldfusion?

This is what i want to do.

I create an album, and after that it goes automatically to image page. So I need to get last auto increment value in insert coding and redirect to insert image page by sending last auto increment value as parameter.

Example

<CFQUERY NAME=”INSERTALBUM” DATASOURCE=”MYSOURCE”>
INSERT INTO ALBUM (ref_id,albumname,timestamp) VALUES (null,’ALBUM NAME’,NOW())
</CFQUERY>

<CFLOCATION URL=”imagelink.cfm?ref=lastinsertid“>

 

Please help.

coldfusionluceemysql
  • 1 1 Answer
  • 143 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. taha Pundit
    2021-04-21T14:46:47+08:00Added an answer on April 21, 2021 at 2:46 pm

    Hi,

    I try my best to answer your question

    In your insert statement add this after datasource.

    <CFQUERY NAME=”INSERTALBUM” DATASOURCE=”MYSOURCE” RESULT=”RESULT”>

    And add this

    <cfset NewPrimaryKey = result.generatedkey>

    <CFOUTPUT>
    <CFLOCATION URL=”imagelink.cfm?ref=#NewPrimaryKey#“>
    </CFOUTPUT>

    Hope this help you solve the problem.

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

Sidebar

Ask A Question

Stats

  • Questions 17
  • Answers 54
  • Best Answers 10
  • Users 11
  • Popular
  • Answers
  • suraya

    WEB HOSTING MANA SESUAI UNTUK BINA LAMAN WEB MACAM SHOPEE ...

    • 10 Answers
  • taha

    LAMAN WEB ANDA GUNA CMS APA? JOOMLA? WORDPRESS? DRUPAL?

    • 8 Answers
  • Wpuser

    Why my swift performance cache too big?

    • 6 Answers
  • Wpuser
    Wpuser added an answer Problem solved. Thanks again taha February 20, 2022 at 7:58 pm
  • taha
    taha added an answer It so easy because you have cpanel access. Just click… February 20, 2022 at 7:56 pm
  • Wpuser
    Wpuser added an answer template lawa-lawa boleh beli dekat themeforest https://themeforest.net/ xmahal mana pun… February 18, 2022 at 9:22 pm

Related Questions

  • azriamin

    HOW TO GET CURRENT QUERY SEQUENCE FOR ORACLE USING LUCEE

    • 3 Answers

Top Members

taha

taha

  • 3 Questions
  • 113 Points
Pundit
fadaman

fadaman

  • 0 Questions
  • 52 Points
Teacher
suraya

suraya

  • 0 Questions
  • 35 Points
Begginer

Trending Tags

+13472950001 coldfusion dedicated server hosting joomla lucee mysql php poll template web hosting wordpress wordpress problem продажа тугоплавких металлов

Explore

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

Footer

© 2021 Tanya HostSinimo. All Rights Reserved
Powered by HostSinimo.com

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.