If I replaced the first% s with only 244, I will receive the amount without any problems. But when using a dynamic value in this case, $ shot, it does not seem to get anything, and neither my request is executed, like other results are in order (e.g. story.id, stories.title).
$query = sprintf("
SELECT
stories.id,
stories.title,
stories.timestamp,
stories.text,
users.name,
users.avatar,
users.id AS idus,
(SELECT sum(reviews.amount) FROM reviews WHERE reviews.storyid='%s') AS reviews
FROM stories INNER JOIN users ON stories.uid=users.id WHERE stories.id = '%s'",
mysql_real_escape_string($shot),
mysql_real_escape_string($shot));
The shooting comes from here:
$shot = $_GET['shot'];
source
share