i have a database table 'movies'. in this table there are 25 columns of information per row. Ie, movie title, poster, cast, synopsis etc.
At the moment i am fetching the information like this
$query = "SELECT * FROM `movies` WHERE `title`='$moviename'";
$result = $con->query($query) or die($mysqli->error.__LINE__);
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$moviedetails['title']=$row['title'];
$moviedetails['poster']=$row['poster'];
}
}
else {
echo 'NO RESULTS';
}
because i have 25 columns its long work writing out each variable. is there a way to fetch the information and i can then call to it by using
$moviedetails['column name']
ie
im new to php and mysql so any help appreciated.
thanks lee
$moviedetails['title']
fetches the information from the 'title' column.