Well you're using single quotes around the whole query meaning any variables won't be expanded, $temp will remain as exactly that, change it to
$q = "SELECT * FROM mayballcomments WHERE postNo = '$temp'";
You can even take the variable outside of the string, but read up on that elsewhere.