Jump to content

[SOLVED] invalid syntax ?? with query


ag3nt42

Recommended Posts

can anyone tell me what is wrong with this query

 

<?php

$Inject[$y]="INSERT INTO [ClientsEmails] WHERE CompanyName='".$Company[$y]."' (username, password) VALUES ('".$username[$y]."','".$password[$y]."')";
?>

 

 

keep getting error saying syntax error near WHERE on line /\(that line)

 

Link to comment
Share on other sites

Don't take every tutorial as pure truth.  There can be mistakes.  The MySQL manual for INSERT highlights the 3 syntax options as:

 

INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [iGNORE]
    [iNTO] tbl_name [(col_name,...)]
    {VALUES | VALUE} ({expr | DEFAULT},...),(...),...
    [ ON DUPLICATE KEY UPDATE
      col_name=expr
        [, col_name=expr] ... ]

Or:

INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [iGNORE]
    [iNTO] tbl_name
    SET col_name={expr | DEFAULT}, ...
    [ ON DUPLICATE KEY UPDATE
      col_name=expr
        [, col_name=expr] ... ]

Or:

INSERT [LOW_PRIORITY | HIGH_PRIORITY] [iGNORE]
    [iNTO] tbl_name [(col_name,...)]
    SELECT ...
    [ ON DUPLICATE KEY UPDATE
      col_name=expr
        [, col_name=expr] ... ]

 

No WHERE. =P  It logically doesn't make much sense....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.