I want to pass a php variable in mysql_query such as:
$tty = '217';
$num_of_comments = mysql_query("SELECT count(*) FROM comments WHERE img_id = '.$tty.'");
$num_of_comments1 = mysql_fetch_array($num_of_comments);
$num_of_comments2 = $num_of_comments1[0];
echo $num_of_comments2 ;
However, I am not able to get the value needed in num_of_comments2. It returns a 0 on echo.
SELECT count(*) FROM comments WHERE img_id = ?