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.
#
# 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;
# 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;