jmxfield on Wed, 16 Dec 2015 18:34:57

Ok, as far as I am aware I have done this IAW the php docs, however no matter what I try I am still returning the same error sqlsrv_num_rows resource/boolean error.   After 2 days trying to understand why I am turning to this forum in hope someone can spot the error. 


$id = urldecode(base64_decode($_GET['id']));

// match userID in DB
$query= "SELECT email FROM users WHERE userID = ?";

$var = array($id);

$result = sqlsrv_query($conn, $query, $var, array( "Scrollable" => SQLSRV_CURSOR_KEYSET ));

if(sqlsrv_num_rows($result)==0) die("error matching user in db : ".sqlsrv_errors());

Any help is much appreciated.  thanks



HoroChan on Fri, 18 Dec 2015 08:33:23

Using urldecode() on an element in <var class="varname"><var class="varname">$_GET</var></var> or <var class="varname"><var class="varname">$_REQUEST</var></var> could have unexpected and dangerous results.

Have you debug the value of $id?