$result->num_rows returns a value of 64(all records) when it should return a value of 29 whereas $counter returns a value of 0 suggesting no records. I'm thinking it's an issue with my prepared statement but I'm not entirely sure what it could be.
Ajax
$.ajax
({
  url: 'query.php',
  type: 'POST',
  data: {Category: cat},
  //dataType: 'json',  
  success: function(result) 
  {  
    if(result) 
    {   
      console.log(result);          
    }
  },
  error: function() 
  {
    alert("error");
  }      
}); // end ajax call
PHP
<?php
require '_conn/connection.php'; 
$stmt = $conn->prepare("SELECT * FROM portfoliotb WHERE Category = ?");
$stmt->bind_param('s', $cat); 
$cat = $_POST['Category'];
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) 
{
    echo $result->num_rows.",";
} 
else 
{
    echo "0 results";
}
$records = [];
$counter=0;
while( $row = mysql_fetch_row( $result ) )
{
    $counter++;
    //$records[] = array('Id' => $row['Id'], 'Category' => $row['Category'],'Directory' => $row['Directory'],'Description' => $row['Description'],'Code' => $row['Code']);
    //array_push( $records, $row['Category'] );   
    //array_push( $records, array("Id"=>$row['id'],"Category"=>$row['Category'],"Directory"=>$row['Directory'],"Description"=>$row['Description'],"Code"=>$row['Code'])); 
}
echo $counter;
//echo json_encode( $records );
?>
