SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist cronsrcs's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DB Insert - creates 3 identical db records

    I have a php page that has a form that performs an insert into a mysql db table, but it seems to insert 3 duplicate records into the db.

    Below is my insert statement as it appears in the php page:

    $sql = "INSERT into SideLink (link_id, link_title, link_url, link_value, link_parameter) VALUES ('','$link_title','$link_url', '$link_value', '$link_parameter')";

    I have also echoed the sql statement and this is an example:

    INSERT into SideLink (link_id, link_title, link_url, link_value, link_parameter) VALUES ('','dslllsdls','dcdldld', '', '')

    Has anyone else come across this before?

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,323
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    run the query outside of your php script

    check to see how many rows it inserted

    if the answer is 1, ask a moderator to move this thread to the php forum

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Evangelist cronsrcs's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    r937,

    when i ran the query on the command line, it inserts just one record.....

    Who do i have to contact to get this thread to the php forum??

    Thanks


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
  •