I'm trying to get an array from a database, and set the result as a variable (in this case, named '$Rate'). The code which worked using mysqli is this:
//Getting Hire Rate
$Rate = array();
$ratequery = "SELECT HireRate FROM movie WHERE MovieID LIKE '$MovieID'";
$rate = mysqli_query($con, $ratequery)
or die("Error: ".mysqli_error($con));
while ($row = mysqli_fetch_array($rate, MYSQLI_ASSOC)) {
$Rate[] = $row['HireRate'];
};
mysqli_free_result($rate);
I'd like to do the same using PDO. I've read various pages but cannot get it to work.