Hi all:
I am starting to use mysqli after getting my feet wet with sqlsrv (switching from MSSQL to MySQL).
The following code appears fine, but my gut feeling is this isn't the "right" way to do things.
I had read somewhere that fetch_array is not necessary with mysqli. If that is true I am not sure why. Also, I originally was closing the stmt with mysqli_stmt_close($stmt) but that was throwing errors. I switched to mysqli_free_result($stmt). The errors stopped but I am not sure why or if I did the right thing.
Any words of wisdom appreciated!
$sql="SELECT COUNT(DISTINCT Player) AS Total FROM WishList";
$stmt = mysqli_query($link, $sql);
if(!$stmt)
{
die('MySQL error: ' . mysqli_error($link));
}
$TotalRows = mysqli_fetch_array($stmt);
mysqli_free_result($stmt);