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.
Results 1 to 2 of 2

Thread: sql error?

  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy sql error?

    hi all,
    i wonder what's going on. it seems fine to me but it just isn't working.here is the code:

    PHP Code:
    //sent with this link
    $query "SELECT guestbook_id, contents, sender, receiver, type, date_sent, confirm, uniqueID FROM tblguestbook WHERE receiver = '".$_GET["username"]."' AND confirm=0";
                            
    $rs mysql_query($query);
                            
    $numRows mysql_num_rows($rs);

    <
    tr>
                    <
    td align="right\" class=text><a href=\"confirm.php?id=$row->uniqueID&guestbookID=$row->guestbook_id&username=".$_GET['username']."\">[Confirm]</a></td>
                    </tr> 
    PHP Code:
    //received here
    $query "UPDATE tblguestbook SET confirm = 1 WHERE username = '".$_GET["username"]."' AND guestbook_id='".$_GET["guestbookID"]."' AND confirm = 0 AND uniqueID='".$_GET["id"]."'";
      echo(
    $query);
        
    $rs mysql_query($query);
      
    $affRows mysql_affected_rows($rs);
          if (
    $affRows 0){
                        
    $message "<font color=black>SUCCESS:</font> Your Greeting Book Has Been Successfully Updated.";
                            }
                    else{
                        
    $message "<font color=black>ERROR:</font> A problem has occured when you tried to update your greeting book. " 
                            
    "The possible reasons might be your username does not match or " 
                            
    "due to that it could've been confirmed ealier on. ";

    but it lands on this part:

    $message = "<font color=black>ERROR:</font> A problem has occured when you tried to update your greeting book. " .
    "The possible reasons might be your username does not match or " .
    "due to that it could've been confirmed ealier on. ";
    i also tried checking the error by echoing the $query and it seems fine to me:
    UPDATE tblguestbook SET confirm = 1 WHERE username = 'turbo' AND guestbook_id='1' AND confirm = 0 AND uniqueID='2323d'
    i wonder what's wrong. pls advice.thank you.
    Warm Regards,
    Mivec

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    And if u look into database, is there anything that matching all four conditions:
    username = 'turbo' AND guestbook_id='1' AND confirm = 0 AND uniqueID='2323d'
    Last edited by V@no.; 05-14-2004 at 07:39 AM.


  •  

    Posting Permissions

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