您真的很接近,您无法正确获取:
require("config.PHP");
if(empty($_SESSION['user']['id']))
{
header("Location: index.PHP");
die("Redirecting to index.PHP");
}
$userid = $_SESSION['user']['id'];
$sql = "SELECT my_music, my_movies, my_weather, my_maps, my_news
FROM user_preferences
WHERE user_id = :userID";
$stmt = $db->prepare($sql);
$stmt->bindParam(":userID", $userid);
$stmt->execute();
$result = $stmt->fetch();
<input id="mymusic"
type="check@R_187_2419@"
name="mymusic"
<?PHP echo ($result['my_music']==1 ? 'checked' : '');?>
/>
<input id="mymovies"
type="check@R_187_2419@"
name="mymovies"
<?PHP echo ($result['mymovies']==1 ? 'checked' : '');?>
/>