Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   autogallerySQL perl directive (http://www.greenguysboard.com/board/showthread.php?t=35396)

fucter 2006-10-18 10:24 PM

autogallerySQL perl directive
 
Im trying to get a perl script to work that displays different banner ads randomly, so everytime I do a build I should have a diffrent banner ad

heres what I wrote:
Code:

#!/usr/bin/perl
my $range = 13;
  my $random_number = int(rand($range));

  $image[1]['pic']='example.banner.jpg';
  $image[1]['link']='http://some.domain';

$image[n]['pic']='example.banner.jpg';
  $image[n]['link']='http://some.domain';

 

print '';
print '';

obvioulsy, I left some links out and abbreviated them for 1 to n

well, this code doesnt work, i tried replacing 'print' with 'data .=' but that didnt work either (well, it sorta worked, the image and the link were the same for some reason.
Anyone have an idea what I am talking about, and how to fix it?

cd34 2006-10-18 10:39 PM

First, you're using perl, not php. ['asdf'] will evaluate as 0, {'asdf'} is how perl accesses hashes.

I would suspect you want something like:

Code:

#!/usr/bin/perl

my $range = 13;
my $random_number = int(rand($range));

$image[1]='example.banner.jpg';
$link[1]='http://some.domain';

$image[n]='example.banner.jpg';
$link[n]='http://some.domain';

 

$data .= '';
$data .= '';


fucter 2006-10-19 04:25 PM

oh god, is there an emoticon for embarrassed? Thnaks, Ill try that out|roses|


All times are GMT -4. The time now is 09:48 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc