Jump to content

phpmyadmin vs my script


phantom

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/62490-phpmyadmin-vs-my-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.