SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    update or insert

    If there is an ID number that matches the customer ID in the customers table UPDATE
    If there was no matching ID number, INSERT
    this forum is my last chance

    insert functions working properly but update not at all

    PHP Code:
    if ($email && $password && $bannid){
        
    $validlogin verifylogin($email,$password);
        if (!
    $validlogin){
            print 
    "$ermessage1_member";
            exit;
        }
        if(
    $validlogin!=NULL){
        
    $sql "INSERT INTO $tablebanned (id,ip1,ip2,ip3,ip4,ip5,ip6,ip7,ip8,ip9,ip10) VALUES ('$validlogin','$ip1','$ip2','$ip3','$ip4','$ip5','$ip6','$ip7','$ip8','$ip9','$ip10')";
          } 
        else 
        {
        
    $sql "UPDATE $tablebanned SET ip1='$ip1', ip2='$ip2', ip3='$ip3', ip4='$ip4', ip5='$ip5', ip6='$ip6', ip7='$ip7', ip8='$ip8', ip9='$ip9', ip10='$ip10' WHERE id=$validlogin";
          }
        
    $result mysql_query($sql); 

  2. #2
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face

    Fast answer
    but how ???
    Just use REPLACE INTO
    Im not a Profi

  4. #4
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
     $sql "REPLACE INTO $tablebanned (id,ip1,ip2,ip3,ip4,ip5,ip6,ip7,ip8,ip9,ip10) VALUES ('$validlogin','$ip1','$ip2','$ip3','$ip4','$ip5','$ip6','$ip7','$ip8','$ip9',  '$ip10')";
    $result mysql_query($sql); 
    This assumes the $tablebanned is autoincrement.

  5. #5
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Oh, Good Impossible
    Three days without sleep

    THANKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS HardCodeddddddddddddddddddddddd

    practicly I need only this ? Right

    without update or insert

    PHP Code:
    $sql "REPLACE INTO $tablebanned (id,ip1,ip2,ip3,ip4,ip5,ip6,ip7,ip8,ip9,ip10) VALUES ('$validlogin','$ip1','$ip2','$ip3','$ip4','$ip5','$ip6','$ip7','$ip8','$ip9','$ip10')";
        
    $result mysql_query($sql); 


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
  •