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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.