+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 5 of 6

Thread: Insert query.

  1. #1
    prettyboy_56592
    Guest

    Insert query.


    Hi everybody!

    Could you teach me how to get back the “primary key”: (“id”), from an “insert query”?



    *









    INSERT INTO mytable

    (email, firstname, name)

    VALUES

    ('#formData.email#', '#formData.firstname#', '#formData.name#')





    *

    How could I get back the primary key:”id” and send it to another page?

    Thanks a lot!
    More Information:
    1. This function is used to send a query or command to a MySQL connection
    2. To use it, set up a mysql insert or update query for a text field without the single quotes, like this:
    3. I want to insert static values with every element of another table
    4. Learn how to use the SQL INSERT INTO clause to insert data into a SQL database table
    5. If you want to insert multiple rows using only one insert statement refer article SQL SERVER – Insert Multiple Records Using One Insert Statement
    6. 5 posts - 5 authors - Last post: Dec 10, 2009insert query in c# ASP

    More:


  2. #2
    o0ohieuvqlso0o
    Guest


    Quote:








    Originally Posted by Hercf


    Hi everybody!

    Could you teach me how to get back the “primary key”: (“id”), from an “insert query”?



    *









    INSERT INTO mytable

    (email, firstname, name)

    VALUES

    ('#formData.email#', '#formData.firstname#', '#formData.name#')





    *

    How could I get back the primary key:”id” and send it to another page?

    Thanks a lot!











    I use msSQL its different for different DB's. Coldfusion 8 only



    http://www.forta.com/blog/index.cfm/2007/7/6/ColdFusion-8-Can-Return-Identity-Values
    More Information:
    1. INSERT command is used to append or add a record to a database
    2. $this->qStatsGlobales->SQL="INSERT INTO STAT0 (ID, DDATE, IP, USER_AGENT) VALUES (null, null,'', null)";
    3. 6 posts - 2 authorsglobal $wpdb; $wpdb->query("INSERT INTO $wpdb->ticket (CompanyName, CustomerName) VALUES('test1','test 2')");
    4. This code snippet shows how to insert multiple values using one query
    5. 6 posts - 4 authors - Last post: Sep 20, 2009INSERT INTO Query MySQL and other databases
    6. Now, queries can be executed using mysql_query() method to insert values into the database

  3. #3
    quy9000iso
    Guest

    Hi CR250,

    Thank for tips and the path you provided to me!

    Hercf.
    More Information:
    1. 12 posts - 5 authors - Last post: Sep 29, 2009I try to write an insert query which receive two values from xform and insert it to mysql database
    2. echo your query to see that it's correctly constructed
    3. When i run the insert SQL i can an error: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query
    4. 3 posts - 1 author - Last post: Mar 29, 2005Hi, I need help with an SQL Statement that allows me to INSERT A RECORD into a table for every user/account that exists for a particular code in a another table
    5. Hey guys, i am having a problem in my query statement
    6. A generic scenario would be that you are inserting data
    7. if you are extending Zend_Db_Table_Abstract and using its own insert method to insert data use Zend_Db_Profiler_Firebug

  4. #4
    nvkkkkk
    Guest

    Hello Hercf,



    I use the following to get the lastID. Hope this helps:





    INSERT INTO TableName

    (Fieldname)

    VALUES

    ('Value');

    SELECT LastID = @@identity

    More Information:
    1. For my website I am creating the following 2 tables (Employee, Orders) as a part of the JDBC tutorial for insert in jdbc insert query
    2. Here is my problem: I execute an SQL query and the result of the query is inserted in a file
    3. This tutorial enables you to insert records into database with Java Servlets in a most efficient and optimized way
    4. 2 posts - 2 authors - Last post: Feb 9, 2009hello $this->qStatsGlobales->SQL="INSERT INTO STAT0 (ID, DDATE, IP, USER_AGENT) VALUES (null, null,'$ip_simple', null);"; what is the
    5. In Oracle, I dont think you can use both value & a select statement in a insert query
    6. Value & "'"), "nouser") If strUSER = "nouser" Then INSERT INTO table2; VALUES (username
    7. 6 posts - 2 authors - Last post: Mar 27, 2001[Archive] execute insert query from vb6 VB Classic

  5. #5
    lungvai_2007
    Guest

    Thank you All !

    H.
    More Information:
    1. So conventionally, we will insert a query into a log table and then fire an Update query which will update the counter by +1
    2. hai this is my query "insert into a1(name) values('dinesh' kumar') plz help me using php
    3. Looking at the code, it strikes me as very strange that you're repeating the same variable in your "insert
    4. So all i ask for is "Generate Insert Query" feature that can generate an
    5. It sounds on the face of it, as though the database is expecting an integer value to be inserted there
    6. 3 posts - 2 authors - Last post: Jan 19MySQL Insert Query
    7. 2 posts - 2 authors - Last post: Jun 24, 2005Question SQL db - custom insert and select query app needed
    8. You can insert multiple records in Enterprise Manager of SQL-Server instead of using a Query Editor
    9. Running the query gives the error "74 records cannot be inserted due to key violations"
    10. For Example: To insert a row into the employee table from a temporary table, the sql insert query would be like,

+ Reply to Thread
Page 1 of 2
1 2 LastLast

Similar Threads

  1. How can i insert
    i am using a coldfusion web page to connect to my data base. i am using microsoft access and i named it feedback. i created a table which i named...
  2. VB: Insert any .exe???
    Hi, How can i insert a exe in my form? For example ive got teamviewer portable.exe and id like to have a little window in the form(like the...
  3. How to insert SID in a form ?
    Hi all I can successfully use a SID in a URL , how would you modify a form to include SID . For example .... how would you modify the below form...
  4. Trying to run my first query to INSERT to a database
    Hey guys im very new to this so be gentle. I have created a database for a friend called cyberkitten Within the cyberkitten database...
  5. why doesn't it insert in database?
    Code: Your feedback is important. To send your comments put your: Name:

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Automatic Translations (Powered by Powered by Google):
Afrikaans Albanian Arabic Belarusian Bulgarian Catalan Chinese Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician German Greek Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Taiwanese Thai Turkish Ukrainian Vietnamese Welsh Yiddish