Anyone know why this isn't 'ordering' by rand() ? There are 3 entries in the SQL database, of which 2 of them should match. The appropriate code is;
my $CatID = shift;
print "Checking for category $CatID<BR>";
my $banner;
# grab the stuff form the database...
my $table = $DB->table('CatAdverts');
$table->select_options ("ORDER BY RAND()",'LIMIT 1');
my $sth = $table->select( GT::SQL::Condition->new('Categories', 'LIKE', "% $CatID %") );
And the data in the MySQL database/table is;
1 Test Title http://www.google.com 1 2 3 4 7 9 11
2 Test Title 2 http://www.google.com 1 2 3 4 7 9 11
3 test again http://www.google.com 3 4 1 2
Anyone got any ideas? I always brings up SetID 1
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
# get the category ID we wanna use... my $CatID = shift;
print "Checking for category $CatID<BR>";
my $banner;
# grab the stuff form the database...
my $table = $DB->table('CatAdverts');
$table->select_options ("ORDER BY RAND()",'LIMIT 1');
my $sth = $table->select( GT::SQL::Condition->new('Categories', 'LIKE', "% $CatID %") );
And the data in the MySQL database/table is;
Code:
SetID Title URL Categories 1 Test Title http://www.google.com 1 2 3 4 7 9 11
2 Test Title 2 http://www.google.com 1 2 3 4 7 9 11
3 test again http://www.google.com 3 4 1 2
Anyone got any ideas? I always brings up SetID 1

Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!