I can't figure out why this if/select statement isn't assigning the retrieved value to the target variable. When I run the select query directly in mysql the retrieved value is as expected. Anyone know what's wrong? Thanks.
Code:
if ( !isset($_POST["cover"]) ){ $selectDefault = sprintf("SELECT imageId FROM images WHERE id=%s ORDER BY position LIMIT 0, 1", $format->formatValue($_SESSION["id"])); $defaultResult = mysql_query($selectDefault, $connected) or die("Error: " . $selectDefault . ' ' . mysql_error()); $default = mysql_fetch_assoc($defaultResult); $selectedCover = $default["imageId"]; } else { $selectedCover = $_POST["cover"]; }
Comment