Q:

MySQL Select statement not outputting anything

my SQL statement is not outputting anything when run. Just an empty screen.
Here is my PHP code:
<?php
$con = mysqli_connect("localhost", "root", "root","payBills");
$paidBills = "SELECT * FROM houseBills WHERE houseID = '20'";
$resultset = mysqli_query($con, $paidBills);
$records = array();
//Loop through all our records and add them to our array
while ($r = mysqli_fetch_assoc($resultset)) {
    $records[] = $r;
}
//Output the data as JSON
echo json_encode($records);
?>

and here is my SQL tables
  CREATE TABLE `houseBills` (
  `houseBillID` int(11) NOT NULL AUTO_INCREMENT,
  `houseID` varchar(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `amount` varchar(10) NOT NULL,
  `date` varchar(50) NOT NULL,
  `addedBy` varchar(100) NOT NULL,
  PRIMARY KEY (`houseBillID`),
  UNIQUE KEY `houseBillID` (`houseBillID`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `houseBills`
--

INSERT INTO `houseBills` (`houseBillID`, `houseID`, `name`, `amount`, `date`, `addedBy`) VALUES
(1, '20', 'Loo roll', '£10', '10', 'samstone920@googlemail.com'),
(2, '20', 'toothpaste', '3', 'egreg', '44tq');

Is there any plainly obvious that I am missing?

A:

Table is currently set as CHARSET=latin1 JSON_ENCODE doesn't except this. See this post: json_encode is returning NULL?. ALTER TABLE houseBills CONVERT TO CHARACTER SET utf8;
Because the table already contains data before the alteration this stills give a problem. In this case (test phase project) the solution is to re-enter data. For large existing table perhaps try copying data to new table might offer a solution. Please note this is untested.

