SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    something wrong?

    anyone see anything wrong with this?

    $result2=mysql_query("INSERT INTO articles VALUES ('$aid', '$time', '$article_headline', '$article_body'")
    or die("line 184 ". mysql_error());

    the error is:

    line 184 You have an error in your SQL syntax near '' at line 1

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi whacked,

    Yep, I see a possible mistake. How many fields do you have in your table? Unless you are inserting a value for every field, you are not using the proper syntax for an INSERT statement. Go here for basic SQL syntax:

    http://www.SQLCourse.com
    Last edited by 7stud; Jun 2, 2001 at 22:08.

  3. #3
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got 4 fields.. So I am putting a value in each key

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    each key?

  5. #5
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    found it... I forgot to close the VALUES param.

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Another possibility, is that you might not be able to use the dot operator inside the die() function. Try getting rid of ". mysql_error()".

  7. #7
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yep, nice catch!
    Last edited by 7stud; Jun 2, 2001 at 22:47.

  8. #8
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its always the most simple answer

  9. #9
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Keep that sql link. There is a second tutorial that has aggregate functions, order by, group by, joins, etc. that will prove useful to you.


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
  •