Gossamer Forum
Home : General : Perl Programming :

Re: [Chaz] simple Database count

Quote Reply
Re: [Chaz] simple Database count In reply to
Thanks Chaz,

# Query 1 to get desired records for your loop
my $last_five = q~SELECT imdbID, title
FROM videodata
WHERE Mediatype <> '50'
ORDER BY created DESC LIMIT 5~;


The query gives me every thing I need I throught it was the correct query to use, my aim was to get the last 5 entered records in the table videodata and to pull out the imdbid value as well as the title and to filter out records that did not have a media value of 50. That was my aim with that SQL query and it works but is it right :-) I attached a copy of the table just in case there was another way to do it.

So I went with option 1 it created the template just fine :-)

Just have to use
my $tmpl rather than my $t


So thank you very much Chaz for the time you spent looking at my newbie code and helping me on this :-)
from these simple code projects I learn so much and I realy appreciate you code kings looking at my simple code and helping me out.



Code:

#
# Structure for the `videodata` table :
#
CREATE TABLE `videodata` (
`id` int(10) unsigned NOT NULL auto_increment,
`md5` varchar(32) default NULL,
`title` varchar(255) default NULL,
`subtitle` varchar(255) default NULL,
`language` varchar(255) default NULL,
`diskid` varchar(15) default NULL,
`comment` varchar(255) default NULL,
`disklabel` varchar(32) default NULL,
`imdbID` varchar(7) default NULL,
`year` year(4) default NULL,
`imgurl` tinytext,
`director` varchar(255) default NULL,
`actors` text,
`runtime` int(10) unsigned default NULL,
`country` varchar(255) default NULL,
`plot` text,
`filename` varchar(255) default NULL,
`filesize` int(16) unsigned default NULL,
`filedate` datetime default NULL,
`audio_codec` varchar(255) default NULL,
`video_codec` varchar(255) default NULL,
`video_width` int(10) unsigned default NULL,
`video_height` int(10) unsigned default NULL,
`istv` tinyint(1) unsigned NOT NULL default '0',
`lastupdate` timestamp(14) NOT NULL,
`seen` tinyint(1) unsigned NOT NULL default '0',
`mediatype` int(10) unsigned NOT NULL default '0',
`custom1` varchar(255) default NULL,
`custom2` varchar(255) default NULL,
`custom3` varchar(255) default NULL,
`custom4` varchar(255) default NULL,
`created` datetime default NULL,
`owner` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `title_idx` (`title`),
KEY `diskid_idx` (`diskid`),
FULLTEXT KEY `actors_idx` (`actors`)
) TYPE=MyISAM;
Subject Author Views Date
Thread simple Database count SimonTOZ 5323 May 1, 2004, 5:17 AM
Thread Re: [SimonTOZ] simple Database count
Chaz 5182 May 13, 2004, 9:33 PM
Thread Re: [Chaz] simple Database count
SimonTOZ 5201 May 13, 2004, 11:05 PM
Thread Re: [SimonTOZ] simple Database count
Chaz 5174 May 14, 2004, 8:33 AM
Post Re: [Chaz] simple Database count
SimonTOZ 5151 May 14, 2004, 7:14 PM