phantom Posted July 30, 2007 Share Posted July 30, 2007 MySQL version: 5.0.22 SELECT SQL_CALC_FOUND_ROWS distinct id.image_filename, dc.dc_title, dc.dc_type1, dc.dc_type2, dc.dc_type3, (SUM (MATCH (article_word) AGAINST ('corn' )) + SUM (MATCH (dc_title, dc_type1, dc_type2, dc_type3) AGAINST ('corn' )) + SUM (MATCH (title, place_of_publication, type_of_publication) AGAINST ('corn' ))) AS score FROM image_id id, title_metadata t, dc_metadata dc, article_text at WHERE (MATCH (article_word) AGAINST ('corn' ) OR MATCH (dc_title, dc_type1, dc_type2, dc_type3) AGAINST ('corn' ) OR MATCH (title, place_of_publication, type_of_publication) AGAINST ('corn' )) AND id.image_id = t.image_id AND id.image_id = dc.image_id AND id.image_id = at.article_text_id GROUP BY id.image_filename ORDER BY score DESC Table structure CREATE TABLE `image_id` ( `image_id` varchar(55) NOT NULL default '', `image_filename` varchar(55) default NULL, PRIMARY KEY (`image_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `title_metadata` ( `image_id` varchar(55) NOT NULL, `title` varchar(255) NOT NULL, `title_abbreviation` varchar(100) default NULL, `change_to_title` varchar(100) default NULL, `place_of_publication` varchar(100) default NULL, `dates_of_publication` varchar(100) default NULL, `type_of_publication` varchar(100) default NULL, `sub_collection` varchar(100) default NULL, PRIMARY KEY (`image_id`,`title`), FULLTEXT KEY `title_metadata_full_index` (`title`,`place_of_publication`,`type_of_publication`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `article_text` ( `article_text_id` varchar(55) NOT NULL, `article_word_coord` varchar(30) NOT NULL default '', `article_word` varchar(255) default NULL, PRIMARY KEY (`article_text_id`,`article_word_coord`), FULLTEXT KEY `article_text_full_index` (`article_word`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Problem: When I execute the query using phpmyadmin, the query is successful and returns a number of results. When I attempt to execute the exact same code in my script it doesn't work. I check it using (if !$query). And the code for !$query is always executed. Furthermore, when I attempt to print the mysql error, nothing is displayed. When I attempt to print the error number, nothing is displayed. What should be displayed: I should receive the contents of all fields selected, with a score at the end of each row. Quote Link to comment Share on other sites More sharing options...
phantom Posted July 30, 2007 Author Share Posted July 30, 2007 anybody? Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 30, 2007 Share Posted July 30, 2007 add an or die() clause to your mysql_query() statement. otherwise, post the PHP code you're using to run the query, because the problem lies with PHP and not MySQL. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.