Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Dec 2003
    Posts
    1,274
    Member #
    4362
    I'm using this query to insert a row to a table, but as the first and last column of the 4 are autofilled (auto increment id and timestamp), I want that values to simply let them do that.
    PHP Code:
    $q "INSERT INTO cronedit_jobs VALUES ( ,'$fDescr','$fCommand', )"
    See the commas? I want that values to adopt the default, not to get a specific value.
    Thanks a lot
    PS- Of course that query results in a error...

  2.  

  3. #2
    Senior Member ajaspers's Avatar
    Join Date
    Apr 2003
    Posts
    149
    Member #
    1150
    For the auto_increment column, put NULL. I don't use MySQL timestamp fields, but try that for the last column as well.

  4. #3
    Senior Member seanmiller's Avatar
    Join Date
    Sep 2003
    Location
    Glastonbury, UK
    Posts
    868
    Member #
    3263
    Liked
    1 times
    You should specify the columns you are populating...

    INSERT INTO cronedit_jobs ( Descr, Cmd ) VALUES ( '$FDescr', '$FCmd' ) ;

    ...and leave out the others.

    Sean

  5. #4
    Senior Member
    Join Date
    Dec 2003
    Posts
    1,274
    Member #
    4362
    Thanks, that worked

  6. #5
    Senior Member jlgosse's Avatar
    Join Date
    Jan 2004
    Location
    Newfoundland, Canada
    Posts
    1,037
    Member #
    4570
    Liked
    7 times
    Leave out ones, like he said for default values, but if you have a timestamp col, use the MySQL NOW() function.
    PHP Code:
    <?php
    INSERT INTO cronedit_jobs 
    DescrCmdDatep VALUES '$FDescr''$FCmd'NOW() ) ;
    ?>


  7. #6
    Senior Member
    Join Date
    Dec 2003
    Posts
    1,274
    Member #
    4362
    Happy bday!

    Anyway, that isn't needed as it works without that

  8. #7
    Senior Member jlgosse's Avatar
    Join Date
    Jan 2004
    Location
    Newfoundland, Canada
    Posts
    1,037
    Member #
    4570
    Liked
    7 times
    Best kind! Thanks though!



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:15 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com