Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts

    Question wrong synax error

    Error:
    SQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, to) VALUES ('slappyjaw', 'slappyjaw')' at line 1.
    Developer Details:
    SQL error: INSERT INTO friend_requests (from, to) VALUES ('slappyjaw', 'slappyjaw');. (SQL_ERROR)
    tNG Execution Trace - VIEW

    ugh idk why i am getting this error. I have tried so many different things and i dont think that there is anything that is wrong with my synax. this is it

    PHP Code:
    $customTransaction->setSQL("INSERT INTO friend_requests (from, to) VALUES ({From_}, {To_});"); 
    Any help is appreciated thanks!!
    The from and to part at the end is a variable. But is there something that you have to add before the begining of the colum selection part of the mysql.
    Last edited by slappyjaw; 08-28-2009 at 07:45 AM.

  • #2
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    i noticed you are using either Developer toolbox or mx kollection to build this, but this doesnt look like something it would generate, did you change the value variables at all?

  • #3
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    yes it is a custom sql synax. Do you use the developer toolbox. Also witht eh synax that it created i got a create fake record set error. Idk why though?

  • #4
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    That's what I thought (that the variables were weird, I wasn't familliar with the specific libraries), but the error messages seemed to print out the correct values (I'm assuming)
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #5
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    is it inserting the data at all?

  • #6
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    yes. i didnt think that there was anything wrong with the information but my mysql server was also updated and is the current version. idk if that makes the difference.

  • #7
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    no to seco's post

  • #8
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    can you post more of the code for this

  • #9
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    PHP Code:
    <?php
    // Load the common classes
    require_once('includes/common/KT_common.php');

    // Load the tNG classes
    require_once('includes/tng/tNG.inc.php');

    // Make a transaction dispatcher instance
    $tNGs = new tNG_dispatcher("");

    // Make unified connection variable
    $conn_mysql = new KT_connection($mysql$database_mysql);

    // Start trigger
    $formValidation = new tNG_FormValidation();
    $tNGs->prepareValidation($formValidation);
    // End trigger

    // Make a custom transaction instance
    $customTransaction = new tNG_custom($conn_mysql);
    $tNGs->addTransaction($customTransaction);
    // Register triggers
    $customTransaction->registerTrigger("STARTER""Trigger_Default_Starter"1"POST""KT_Custom1");
    $customTransaction->registerTrigger("BEFORE""Trigger_Default_FormValidation"10$formValidation);
    $customTransaction->registerTrigger("END""Trigger_Default_Redirect"99"{GET.request}");
    // Set custom transaction SQL
    $customTransaction->setSQL("INSERT INTO friend_requests (from, to) VALUES ({From_}, {To_});");
    // Add columns
    $customTransaction->addColumn("From_""STRING_TYPE""POST""From_""{SESSION.kt_login_user}");
    $customTransaction->addColumn("To_""STRING_TYPE""POST""To_""{GET.request}");
    // End of custom transaction instance

    // Execute all the registered transactions
    $tNGs->executeTransactions();

    // Get the transaction recordset
    $rscustom $tNGs->getRecordset("custom");
    $row_rscustom mysql_fetch_assoc($rscustom);
    $totalRows_rscustom mysql_num_rows($rscustom);
    ?><?
    //Include headers!
    $title "Send friend request";
    include(
    "header.php");
    ?>
    <head>
    <link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
    <script src="includes/common/js/base.js" type="text/javascript"></script>
    <script src="includes/common/js/utility.js" type="text/javascript"></script>
    <script src="includes/skins/style.js" type="text/javascript"></script>
    <?php echo $tNGs->displayValidationRules();?></head>
    <body>
    <p> Are you sure that you would like to send a friend request?</p>
    <p>&nbsp;
      <?php
        
    echo $tNGs->getErrorMsg();
    ?>
    <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
      <table cellpadding="2" cellspacing="0" class="KT_tngtable">
        <tr>
          <td class="KT_th"><label for="From_">From:</label></td>
          <td><input type="text" name="From_" id="From_" value="<?php echo KT_escapeAttribute($row_rscustom['From_']); ?>" size="32" />
              <?php echo $tNGs->displayFieldHint("From_");?> <?php echo $tNGs->displayFieldError("custom""From_"); ?> </td>
        </tr>
        <tr>
          <td class="KT_th"><label for="To_">To:</label></td>
          <td><input type="text" name="To_" id="To_" value="<?php echo KT_escapeAttribute($row_rscustom['To_']); ?>" size="32" />
              <?php echo $tNGs->displayFieldHint("To_");?> <?php echo $tNGs->displayFieldError("custom""To_"); ?> </td>
        </tr>
        <tr class="KT_buttons">
          <td colspan="2"><input type="submit" name="KT_Custom1" id="KT_Custom1" value="Insert record" />
          </td>
        </tr>
      </table>
    </form>
    <p>&nbsp;</p>
    </p>
    </body>
    </html>

  • #10
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    i left out the connection to the mysql part that it created.

  • #11
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    hmm yeah thats very strange, everything looks fine.

    try this for ****s and giggles

    PHP Code:

    $customTransaction
    ->setSQL("INSERT INTO friend_requests (from, to) VALUES ({SESSION.kt_login_user}, {To_});"); 

  • #12
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    mm still no same error its so wierd like sometimes this **** works but then it throws errors i like the developer toolbox but it seems to have bugs. It posts the values still but says theres an error.

  • #13
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    yeah that doesnt make sense, you can surpress the errors if it is inserting the data.

  • Users who have thanked seco for this post:

    slappyjaw (08-28-2009)

  • #14
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Both 'from' and 'to' are MySQL reserved words.

    Ideally, you should change the field names. If you insist on using them, you'll have to enclose them in backticks in your query:
    John

  • Users who have thanked PappaJohn for this post:

    slappyjaw (08-28-2009)

  • #15
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    ok i got it i think it was my MYSQL DATABASE! ugh.. Thank you all for your help especially you seco! and you papajohn. sorry i didnt see your post when i had posted this the webpage was old.
    Last edited by slappyjaw; 08-28-2009 at 07:45 AM.


  •  
    Page 1 of 2 12 LastLast

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •