MySQL Insert Record

I have a database for an operational application & I am trying to build some simple insert pages to insert records into the database.
I have constructed the insert forms, yet when I try to inserta  record, the primary key is not automatically applying to the record, as is an auto-number that should apply to another field? yet the data is populatin within the table? I am assuming that the database would apply this automatically as it does in the application??
what am i missing?
Thanks
Pete

Hi
Thanks for the response.
I have edited the insert statement to take these fields out, however when I insert a record it does go into the database, but again the primary key & the autonumber do not increment?
If i try to enter another record i get
Duplicate entry '' for key 'PRIMARY'
Thanks
Pete

Similar Messages

  • PHP/MySQL Insert Record

    I've got a multi page form that carries values across
    multiple pages with the use of Hidden Fields and then on last page
    inserts the record into a MySQL database (for this I used the built
    in Insert Record function of dreamweaver). My problem is that it
    works well when using Internet Explorer, values are carried forward
    and everything is inserted successfully to the database.
    But, when using Mozilla Firefox it looks as if it works, I
    get the confirmation at the end, but the record is not being
    inserted to the database. I've worked through this step by step and
    the values are being carried across in the hidden fields but it
    just will not insert anything to the database.
    Has anyone got any ideas??
    Thank you in advance.

    Cade06 wrote:
    > Thanks alot for your reply, but I am completely new to
    MySQL, and I am not
    > quite sure how the syntax works. When you say " WHERE
    landlord_username =
    > 'whatever' "I'm not sure what needs to go in the
    'whatever' portion of the
    > code. Do I need to insert static text here or something
    else? I am totally out
    > of my element here, sorry :-/
    It's probably not so much MySQL syntax that's the problem for
    you, but a
    lack of understanding how to work with Dreamweaver
    recordsets, server
    behaviors, and sessions. Building database-driven sites with
    Dreamweaver
    isn't difficult, but there are a lot of things involved.
    The Log In User server behavior automatically creates a
    session variable
    called $_SESSION['MM_Username']. You can use this as a
    parameter to pass
    to the SQL query in the Advanced Recordset dialog box. In the
    SQL area
    you would type (I'm guessing the name of your table and the
    username
    column):
    SELECT landlord_id FROM landlords
    WHERE landlord_username = 'col1'
    Then click the plus button above the Variables area, and
    create a
    Parameter with the following values:
    Name: col1
    Default value: 1
    Runtime value: $_SESSION['MM_Username']
    You can then extract the result of the recordset, and assign
    it to a
    session variable like this:
    $_SESSION['landlord_id'] = $row_recordsetName['landlord_id'];
    > Also, I understand that I need to do this on the login
    page, but do I need to
    > define the recordset again on the add_site page as well?
    I guess I'm still not
    > quite clear on how I specify the session variable as the
    value that needs to be
    > entered in the sites table as the landlord_ID.
    As long as the session is still valid (which it would be if
    you use
    Restrict Access to Page), you will always have access to that
    landlord's
    id through $_SESSION['landlord_id'].
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • PHP/MySQL-Update/Insert Record JavaScript Won't Work!!!

    Hi. I'm consistently running into the following error when I use the update or insert record script in CS4. I've tried deleting the FileCache file. I've tried quitting and relaunching, etc. Anyone else seeing this happen? Solutions anyone? Thanks in advance...
    I'm beginning to think it has something to do with the database, and not the script. Does anything in the screenshot below look wrong or problematic?
    Okay, I found the problem. Shouldn't be a problem, but it is...
    The Field name "length" changed to "height" eliminated the problem. So, you can't use the word "length" in a field? Sounds weird to me.

    airsoftie wrote:
    Okay, I found the problem. Shouldn't be a problem, but it is...
    The Field name "length" changed to "height" eliminated the problem. So, you can't use the word "length" in a field? Sounds weird to me.
    There are lots of words you can't use for column names in MySQL, but "length" isn't one of them. See http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html.
    The problem arises because Dreamweaver uses JavaScript behind the scenes to populate dialog boxes and build server behaviors. In JavaScript, "length" is the property of an array. I suspect the problem is that using "length" as a column name has given the relevant JavaScript used by Dreamweaver indigestion.

  • Insert record works for me, but not my client...

    This is odd - I basically have an ADDT insert record page to add a database record, which as far as I know worked just as it should.
    But my client is saying it doesn't work on her machine - apparently when she hits 'add record' instead of going to the page confirming the record has been added, its just reloading a blank form on the add record page.
    I've just double checked on my machine, and it definitely works for me.
    She's definitely using the correct the URL.
    Its just using mySQL / PHP / phpMyAdmin
    Is there any reason at all that this should be the case, or any ideas what is causing it and what a solution might be?
    Thanks.

    Well, apparently its working for her now in Firefox, so looks like it may have something to do with IE8. I noticed on her screenshot there was something called Internet | Protected Mode : On - so maybe that's being over zealous in some way.

  • Please Help me in inserting record in a table

    Hi,
    Kindly help me on how to insert records in a table that the values are from the another table.
    for example :
    i have table1, all of the records in column1 of table1 will be inserted to table2 column2 . .
    I already tested it to a visual foxpro programming language and it's ok, i used this command :
    *"INSERT INTO table1 (column1) SELECT column2 FROM table2"*
    but when I try it to a JAVA Program, there's an error.
    Please help me.. Thank You.

    Sir, this is what you mean?
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1585)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1500)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1485)
    at remittance.utility.security.frmRole.addtoPermission(frmRole.java:197)
    at remittance.utility.security.frmRole.btnADDActionPerformed(frmRole.java:177)
    at remittance.utility.security.frmRole.access$200(frmRole.java:22)
    at remittance.utility.security.frmRole$3.actionPerformed(frmRole.java:92)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:5517)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
    at java.awt.Component.processEvent(Component.java:5282)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3984)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1791)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

  • Insert Record not saving values

    Hi,
    I am extremely new to Dreamweaver. I am using MX2004.
    I am trying to work with a remote database that I created in
    MySQL and I am using PHP.
    I created a PHP page added my form, added my input fields,
    and used the Insert Record wizard to get to my database on the
    server. I also went to the columns section and where it says
    ‘Fieldname’ Does Not Get a Value. I went and chose my
    value from the drop-down Value box. It now says
    ‘Fieldname’ Gets Value From
    ‘FORM.Fieldname’ as ‘Text’ I have done that
    for all the columns that I am asking the users to fill in including
    the fields that are NOT NULL.
    The problem is once I test it, it is not putting the data in
    the database. When I go back and look at my columns in the Insert
    Record Server Behaviors, many of my columns have reverted to
    ‘Fieldname’ Does Not Get a Value.
    For some reason my values are not being saved.
    Can someone help with this?
    Thanks,
    Socaprice

    Thanks Mike. I've sloghtly modified my question and reposted
    here:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=12&catid=263&threadid =1322354&enterthread=y
    Do you have any thoughts on this?
    Cheers,
    Roger.

  • JavaScript Error when adding the Server Behaviors for insert Record in php_mysql

    Hi guys,
    I am using Adobe DreamWeaver CS4.
    Here is the Scenerio, i am doing  php mysql driven website.
    While adding the server behavior for insert record i got following error
    Plz help me..
    Thanks in Advance
    RafelNash

    Have you found a fix to this??

  • PHP URL Variable from Insert Record Issue

    I have a very simplistic forum style website I have put together. Everything is functionally properly except for one aspect. The basic structure is a page that lists the existing threads (ie: ThreadA, ThreadB, and ThreadC). I have the name of these threads stored in a MySQL database table that is used to generate a repeating dynamic table to grow as the number of threads increases. If the user clicks on one of these links they are taken to a page that displays all of the comments pertaining to that thread. All of the comments are stored in another MySQL database table. I perform a query on this comments page to filter the information in the comments database by the thread name which is passed over from the first page via a URL variable. The link attached to the name of the thread in the repeating table that generates the URL variable is "comments.php?thread=<?php echo $row_threads['threadName']; ?>" This works perfectly, If the user clicks on ThreadB they are taken to the comments page where only the comments pertaining to ThreadB have been filtered and displayed. After the user inserts a comment form ThreadB the comments page reloads displaying the newly created comment.
    Also, on the first page, the user has the option to create a new thread; call it ThreadD. The name of this new thread has to be inserted into two tables; one in the master threads table and one in the comments page any time someone adds a comment. (I'm sure there is a better way to structure this, but this was all I could figure out and for my purposes at hand it is sufficient). When the user is taken to this new comment page I have a query set up to pull the last entry in the threads table from the logged in user, ie the newly created thread topic. I have dragged this query to the page to make sure it is pulling the correct thread heading, and it works just fine. What I'm wanting to have happen is after the user enters the first comment I'm wanting them to be redirected to the main comments page with their new comment listed; giving the illusion that the new comment and existing comments page are the same. I'm trying to pass the newly created thread name, ThreadD, in the URL to the main comments page just like I do if they select it from the existing threads page. Under the insert record wizard I click the 'browse' button to select the comments.php page. I then select 'parameters' to add the thread name query as the URL parameter. The generated code is "comments.php?thread=" . $row_threadName['threadName'] . "". The user does go to the main comments page but the URL variable is not coming with it. What I'm left with in the address bar is ..."/comments.php?thread=&" , but it should be ..."comments.php?thread=ThreadD". I tried copying and pasting the URL link from the existing threads page since that works perfectly, and when I do that the main comments page shows up blank after being redirected from the new comments page. If I hard code this, for testing purposes, into the redirect after insertion section (ie: "comments.php?thread=ThreadD") everything works perfectly and the URL in the address bar of the main comments page is "...comments.php?thread=ThreadD&" I noticed the extra "&", but didn't give it much thought since the site is giving me the behavior I'm looking for. My question is, how do I get this new comment page to pass the variable of the newly created thread name to the main comments page to behave like it does when the thread is selected from the list of existing threads? I know it has to do with how the URL variable is either being generated or built from my query, or how I have it listed in the redirect section of the insert wizard, but I can't figure out where I am going wrong. Please let me know if there are any questions or if I need to clarify any aspect. Any and all help is always appreciated. Thank you.

    Ok, so just to summarize so I am understanding this correctly.  You have an ordering page for tires/wheels.  A customer places an order for tires/wheels and the data is submitted successfully and this includes a symbol for measurement (in.).  But on another summary page the symbol is returning a blank value.
    If this is correct we need to see:
    - First, the code that is inserting the symbol to the database table in question
    - Second, the query and code where you are printing the data to the screen.

  • Insert record wizard date format

    Hi,
    How can i change the default insert from mm/dd/yyyy to uk format dd/mm/yyyy
    currently if i insert 08/05/2010 which is the 8th may 2010 in uk it will put it into database as 2010/08/05 which when i retrieve is the 5th august 2010 in uk.
    is there a config folder anywhere i can change this?
    many thanks

    thanks bregent.
    it is php/mysql
    not sure what that other reply is about after yours but thanks for your advice.
    is there no way in dreamweaver to change the preferences like in addt to a specific date format?
    thanks
    Date: Wed, 19 May 2010 12:25:47 -0600
    From: [email protected]
    To:
    Subject: Dreamweaver Application Development Insert record wizard date format
    You didn't mention what DBMS or scripting language you are using.
    The best way to get dates from a user is to supply 3 fields for input; day, month, year - then assemble them into the string format that the DBMS is expecting.
    >

  • MySQL database record hits counter?

    Can I find out how many times a record from the MySQL databse was called and displayed on a web browser?Basically a MySQL database record hits counter. I’m using PHP/MySQL.
     

    >to the two files that were created
    >Two files?
    Yes 2 files. In Dreamweaver CS3 & CS4 When using the "Insertà Data Objectsà Master Detail Page Set" function you must create two files:
    1. results.php
    2. detail.php
    It appears that these two files work together hand in hand. You did not specify where nor how to include an update record set that gets executed every time another record set that I want to count fires. So I combined the two as one until it was clarified. 
      

  • Insert Record

    If I use the Insert Record behavior (php) to add a record to
    a mysql table is there a way to automatically return the value of
    an auto-increment field? Thanks in advance for any
    suggestions.

    MichaelS wrote:
    > If I use the Insert Record behavior (php) to add a
    record to a mysql table is there a way to automatically return the
    value of an auto-increment field? Thanks in advance for any
    suggestions.
    http://docs.php.net/manual/en/function.mysql-insert-id.php
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • New  browser window after insert record

    I need some help in modifying the insert record so the the
    goto page opens in a new browser window. I'm working with
    PHP/mySQL. I would expect that I need to modify this section of the
    code.
    $insertGoTo = "new_page.php";
    if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
    header(sprintf("Location: %s", $insertGoTo));
    Tried changing the first line to
    $insertGoTo = "MM_openBrWindow('new_page.php',' ',' ')";
    which does not work. I little help would be greatly
    appreciated.

    The only way I know is using javascript.
    Here I give you an example:
    *main.html*********
    <html>
    <head>
    <script language="javascript1.2">
    <!--
    function Change(){
         window.open("child.html","","toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=120,left=300,top=260");
    -->
    </script>
    <body>
    <center>
    <form name="form1">
    <table>
    <tr><td>Selected value:</td><td><input type="text" name="tf" value="(none)"></td></tr>
    <tr><td colspan="2" align="center"><input type="button" value="Change Value" onClick="Change()"></td></tr>
    </table>
    </form>
    </center>
    </body>
    </html>
    *child.html*********
    <html>
    <head>
    <script language="javascript1.2">
    <!--
    function Change(){
         window.opener.document.form1.tf.value=document.form2.select.value;
    -->
    </script>
    <body>
    <center>
    <form name="form2">
    <table>
    <tr><td>Value:</td><td><select name="select"><option value="1">1</option><option value="2">2</option><option value="3">3</option></select></td></tr>
    <tr><td colspan="2" align="center"><input type="button" value="Change" onClick="Change()"></td></tr>
    </table>
    </form>
    </center>
    </body>
    </html>
    Best Regards!

  • Insert Record creates extra blank record

    Hi, all. I'm trying to figure out what I've got going on.
    I have setup a php/mysql job log system.
    The problem: At random moments, my insert record page will create a blank record in my db. It doesn't do every time, nor every other time. It may only happen once in a day, maybe three times in a day. Never is it consistent.
    I know this is a 'can-o-worms', but I'm trying to figure out where to start.
    What are possible causes, etc.. Just some clue.
    Thanks

    I can post code I guess, but I think it has to do with Dreamweaver testing dynamic data automatically. I've turned that option off to see what happens. Any knowledge of that sort of thing.

  • GET LAST INSERTED RECORD

    I am fairly new to flex. So please bear with me no this
    question.
    I would like to get MYSQL ID of the last record I inserted.
    MSQL has as function LAST_INSERT_ID() that is connection based and
    will return the last id of the last inserted record. My thought was
    in the function contained within the cfc to do 2 queries insert the
    record and return the last id directly after (see below). However,
    I don't know how I would read the results back into flex. I am
    unsure how to write the event handler. Thanks
    <cffunction name="insertUser" access="remote"
    returntype="query" >
    <cfargument name="SSN" required="false" type="string"
    hint="SSN"/>
    <cfargument name="FNAME" required="false" type="string"
    hint="FNAME"/>
    <cfargument name="LNAME" required="false" type="string"
    hint="LNAME"/>
    <cfargument name="CLIENTID" required="false"
    type="string" hint="NEW CLIENTID"/>
    <cfquery name="insUser" datasource="DBT">
    INSERT INTO CLIENT (SSN, FNAME, LNAME) VALUES (
    <cfqueryparam value="#ARGUMENTS.SSN#"
    cfsqltype="CF_SQL_VARCHAR" maxlength="12"/>,
    <cfqueryparam value="#ARGUMENTS.FNAME#"
    cfsqltype="CF_SQL_VARCHAR" maxlength="20"/>,
    <cfqueryparam value="#ARGUMENTS.LNAME#"
    cfsqltype="CF_SQL_VARCHAR" maxlength="30"/>)
    </cfquery>
    <cfquery name="qRead" datasource="DBT">
    SELECT last_insert_id() AS CLIENTID
    </cfquery>
    <cfreturn qRead >
    </cffunction>

    I assume you have LCDS installed with CF and you are using
    the remote object service,
    <mx:RemoteObject
    id="myService"
    destination="ColdFusion"
    source="full.path.to.cfc"
    showBusyCursor="true">
    <mx:method name="insertUser"
    result="insertUser_result(event)" />
    </mx:RemoteObject>
    <mx:Scrpit>
    private function insertUser_result(event:ResultEvent) {
    trace(event.result);
    event.result will be the id of the newly inserted record.
    BTW, I would highly recommend you looking into the data
    management servcie. the SQLAssembler can spare you of the CF code
    for simple CRUDs like this.

  • Error while inserting records in sqlLite database

    Hi all
    I am building a hybrid web app in SMP using phonegap and html.
    I am trying to insert records in sql database but i get an error with an undefined error code
    Please see below :
    function openDatabaseFoo() {
      db = window.openDatabase(clientDBName, clientDBVersion, clientDBDisplayName, clientDBMaxSize);
    function createDBTables() {
      db.transaction(function(tx) {
      // Create mine table
      var fooCreate = 'CREATE TABLE IF NOT EXISTS ' + fooTable+ ' (empNo, empName)';
      tx.executeSql(fooCreate , [],
      function (tx, resultSet) {
                //success
      var msg = 'Sucessfully created';
      alert(msg);
      logSuccessMessage(msg);
                function (err) {
                //error code
                var msg = "Error creating table = " + err.code;
                alert(msg);
                logErrorMessage(msg);
    the creation of tables is happening properly because i am getting a success message in the alerts.
    I am getting the error when i am trying to insert records in the above table
    function insertDataTable(){
    db.transaction(function(tx) {
    var insertSql = 'INSERT INTO ' + fooTable + ' (empNo, empName) VALUES ("1603","baker")';
    tx.executeSql(insertSql, [],
      function (tx, resultSet) {
                //success
      var msg = 'Sucessful insertingdata.';
      alert(msg);
      logSuccessMessage(msg);
                function (err) {
                //error code
                var msg = "Error inserting data sql = " + insertSql + " Error code = " + err.code;
                alert(msg);
                logErrorMessage(msg);
    can some one please help.Also guide me where can i check the sqlLite database logs to see more about the error.
    I would really appreciate the help.I have been onto this since past few days now
    Regards
    Shweta

    What is err.code, or the value of msg when the error occurs?
    Thanks,
    Andrew.

Maybe you are looking for

  • Officejet Pro 8500 Premier: How do I force the Copy function to use paper from Tray 2?

    I set the default tray to Tray 2 and locked Tray 1 to protect my envelopes and this works fine when printing from the computer. But when I copy a document using the START COPY button, the printer pulls from Tray 1 and complains about the media being

  • Indesign CS5 Buggy Crashes Many times per day

    I manage to crash CS5 at least 10 times per day. Cut and paste from one layter to another seems to do it alot. Running on a new Core I7 machine. Very disappointed. CS4 rarely crashed. Also I wish Adobe would focus on performace of their programs. CS5

  • NO ACCOUNTING DOCUMENT UGENT

    WHEN I AM DOING INVOICE. I AM GETTING ERROR THAT NO ACCOUTING DOCUMENT GENARATED. PLEASE SOLVE THIS PROBLEM.

  • Error: RFC of "Spda_conflict_check" failed during configuration roadmap

    We are facing problem during implementation of EHP4 on IDES ERP 6.0/NW7.0 on oracle 10.2 during the configuration roadmap. We are using the SAPEHPi with SP level 20. The pahse PREP_EXTENSION/CONFLICT_CHECK terminates with the error Error : RFC of "Sp

  • IBook in two languages

    If you want to publish an iBook in two different lanugages, what's the best way to show the difference between those two version? Using Subtitle, cover, title?