I'm not far removed from a newbie myself. 😃
This may not resolve the problem you're getting but it looks as though your build of string is incorrect as you've used the same quotes within quotes:
$string = 'SELECT `firstname` , `lastname` , `email` , `bus` , `school` '
. ' FROM `tblPetition` '
. ' WHERE 1 AND `privatepolicy` = 'Yes' AND `petition` = 'Yes''
. ' ORDER BY `firstname` ASC LIMIT 0, 30';
I would recommend that you change your string terminators to double quotes rather than single quotes.
$string = "SELECT `firstname` , `lastname` , `email` , `bus` , `school` "
. " FROM `tblPetition` "
. " WHERE 1 AND `privatepolicy` = 'Yes' AND `petition` = 'Yes'"
. " ORDER BY `firstname` ASC LIMIT 0, 30";