mysql - Match user IP address with sql database entry in PHP -


can't figure out what's wrong code, not returning $result:

    // check see if user has voted   $current_user = $_server['remote_addr'];   $select_query = "select * w_poll_counter user_ip = " . $current_user;   echo $select_query;    $result = mysql_query($select_query);   echo $result;    if($result)   {     //user voted - show results page     header("location: show_results.php");     exit();   } 

the echo statements debugging purposes , removed once i've (or you've!) solved problem. echo $select_query returning variable how expect it, echo $result returning nothing @ all. i'm able cast multiple votes same ip address during testing. undesirable!

please help!

thanks

try quoting query

 $select_query = "select * w_poll_counter user_ip = '" . $current_user ."';"; 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -