Please help to fix this warning

Discussion in 'PHP' started by xTutorials, Jun 23, 2009.

  1. #1
    I get this warning on a PHP script: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/petre/public_html/flash-play.net/index.php on line 109

    the code:
    $check = mysql_query("SELECT * FROM Log WHERE IP='$ip' AND Visit LIKE '%$today%'");
    
    [B]$unique = mysql_num_rows($check);[/B]
    
    Code (markup):
    The bolded line is line 109

    Thanks
     
    xTutorials, Jun 23, 2009 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Hi,

    try this one:
    
    $check = mysql_query("SELECT * FROM Log WHERE IP='$ip' AND Visit LIKE '%$today%'") or die(mysql_error());
    
    PHP:
    and let me know the result.
    Can you provide your table structure?
    Regards
     
    koko5, Jun 23, 2009 IP
  3. xTutorials

    xTutorials Well-Known Member

    Messages:
    376
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    #3
    Thanks...your code gave me a more detailed error that helped me solve the problem. I made a typo in the data base and had Visti instead of Visit
    Thanks again :)
     
    xTutorials, Jun 23, 2009 IP