in reply to how do i pass qoutes to in the string.

You can use two methods:
$query = 'select zipcount from table where id = emailid and address != +"" and first != "" group by c.z5' ;
or escape the quotations
$query = "select zipcount from table where id = emailid and address != +\"\" and first != \"\" group by c.z5" ;
but if it is a SQL select, the server will usually accept this:
$query = "select zipcount from table where id = emailid and address != +'' and first != '' group by c.z5";
Regards,

Peter