0

My script is working fine on my local pc using XAMPP, but when I upload it to the server, 90% of the queries work, but this one is throwing an error (at the point it tries to bind the parameters): "PHP Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, bool given in..."

$sql = "WITH myscores AS (SELECT ROW_NUMBER() OVER (PARTITION BY questionid ORDER BY myindex DESC) row_num, questionid, mark FROM quizscore WHERE userid = ? AND unitid = ?) SELECT questionid, mark FROM myscores WHERE row_num <=6";

   $stmt = mysqli_prepare($conn, $sql);
            
        mysqli_stmt_bind_param($stmt, "ii", $userid, $unitid);
        $stmt->execute();
        $result = $stmt->get_result();

If I simplify the SQL query then it no longer throws an error so I know my connection is okay (but it doesn't give me the data I need). Any help gratefully received. Thank you.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Simon
  • 9
  • 3

0 Answers0