When I reduce the query to this...
Code: Select all
SELECT pm.date_sent, pm.message, pm.subject FROM private_messages AS pm, cms_sections AS csWHERE pm.id = '1'
...I get the same results for each row/column repeated over 15 times. There are 15 records in the cms_sections table...
When I add to the very end the following...
...it works. However I generally remember when I was first really learning the basics that repeating rows of data generally meant I was selecting wrong (although it wasn't until recent I knew you could select from multiple tables without having to do a JOIN).
If I throw the JOIN in I get the same error. I minimized the query (because you can technically get away without selecting anything from a table even if you don't choose to even though that's a waste) just to minimize any possible troubles.
Here is a table export (without the test data) in case it helps where each table has the same id column names...
cms_sections
Code: Select all
CREATE TABLE IF NOT EXISTS `cms_sections` ( `id` INT(2) NOT NULL AUTO_INCREMENT, `section_name` VARCHAR(32) COLLATE latin1_general_ci NOT NULL, `section_url` VARCHAR(32) COLLATE latin1_general_ci NOT NULL, `meta_description` VARCHAR(112) COLLATE latin1_general_ci NOT NULL, `meta_language` VARCHAR(16) COLLATE latin1_general_ci NOT NULL, `meta_robots` VARCHAR(19) COLLATE latin1_general_ci NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=16 ;
private_messages
Code: Select all
CREATE TABLE IF NOT EXISTS `private_messages` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `id_for` INT(7) NOT NULL, `id_from` INT(7) NOT NULL, `id_folder` INT(1) NOT NULL, `date_read` DATETIME NOT NULL, `date_sent` DATETIME NOT NULL, `message` TEXT character SET hp8 NOT NULL, `subject` TINYTEXT character SET hp8 NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=6 ;