Reputation: 325
I have this query in PHP which I call from an Android app.
$sql = "SELECT
`asset`.`idasset`,
`asset`.`idlocation`,
`asset`.`asset_barcode`,
`asset`.`asset_number`,
`asset`.`category_name`,
`asset`.`make`,
`asset`.`model`,
`asset`.`serial_number`,
`asset`.`iduser`,
`asset`.`idcost_centre`,
`asset`.`idcondition`,
`asset`.`idstatus`,
`asset`.`latitude`,
`asset`.`longitude`,
`asset`.`asset_description`
from `asset`";
This is the response I receive from the call in Android Studio console:
D/RAW RESPONSE: Notice: Unknown column 'asset.idlocation' in 'field list'
But that field does exist. Here's the full create statement I reverse copied to clipboard in MySQLWorkbench.
CREATE TABLE `asset` (
`idasset` int(11) NOT NULL AUTO_INCREMENT,
`idlocation` int(11) NOT NULL,
`asset_barcode` varchar(50) DEFAULT NULL,
`asset_number` varchar(50) DEFAULT NULL,
`category_name` varchar(50) DEFAULT NULL,
`asset_description` varchar(250) DEFAULT NULL,
`make` varchar(50) DEFAULT NULL,
`model` varchar(50) DEFAULT NULL,
`serial_number` varchar(255) DEFAULT NULL,
`iduser` int(11) DEFAULT NULL,
`idcost_centre` int(11) DEFAULT NULL,
`idcondition` int(11) DEFAULT NULL,
`idstatus` int(11) DEFAULT NULL,
`longitude` varchar(45) DEFAULT NULL,
`latitude` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idasset`),
KEY `cost_center_fk_idx` (`idcost_centre`),
KEY `iduser_fk_idx` (`iduser`),
KEY `category_name_fk_idx` (`category_name`),
CONSTRAINT `category_name_fk` FOREIGN KEY (`category_name`) REFERENCES `category` (`category_name`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `iduser_fk` FOREIGN KEY (`iduser`) REFERENCES `user` (`iduser`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=utf8;
If I run that exact raw query in PHPMyAdmin or MySQLWorkbench it works, but not in PHP.
If I swap around the sequence of the fields I also get the same error with:
`asset`.`asset_description`
`asset`.`latitude`,
`asset`.`longitude`,
But all the other fields are fine. Strange thing is this query worked a few weeks ago. Am I missing something? I don't have any ideas. Starting to think its a PHP or MySQL setup or something.
Any help would be greatly appreciated as time is not on my side.
Upvotes: 1
Views: 1160