By using this site, you agree to our Privacy Policy and our Terms of Use. Close

Forums - General Discussion - Does anyone know web programming, CGI or PERL stuff I guess?

Entroper said:
The traditional web programming way to do this is to put your file into a SQL database (fairly easy to do with comma-separated values) and then do a query. Something like:

SELECT * FROM jewels WHERE serial_min <= serial AND serial_max >= serial

A quick PHP for that would take about 10 minutes to write. Of course, you need SQL up and running on your server.

 I see. Well, that is why it was set up as comma delimited.



Around the Network

Try something like this:

--BEGIN THROWN TOGETHER CODE--

$found = 0;

while($line = ) {
chomp $line;
($ser_range, $grade, $size, $model, $jewels, $run, $year) = split(/\,/, $line);
($low, $high) = split(/-/, $ser_range);
if ($ser_in = $low) {
$found = 1;
last;
}
}

if($found == 1) {...}

else {...}

--END THROWN TOGETHER CODE--

That code was tossed together really quick. You need to open the file and get $ser_in from the browser yourself. I don't know for sure that code'll work, but it should get you started.



This is why I hate Perl. :)



Because its the best language ever?

*reads line noise and laughs at a joke you'll never get*




Gurok wins. Thanks for all the help guys. It seems like everyone's a programmer!


Around the Network

Listen to Entroper, dump the data into an SQL db and then it's 5 minutes of coding to write a PHP form that runs a query against your data.

You can even load the entire file automatically into SQL via the Load Data Local Infile cmd, so there's little work that would need to be done.



The only teeth strong enough to eat other teeth.

Was working on my PHP based online AFL tipping comp while I read this... so had a little LOL :)

Agree - use a SQL database. Its worth setting up, and really wouldn't take long at all.

...but hey - if efficiency isn't the goal, then don't worry about it! 



Gesta Non Verba

Nocturnal is helping companies get cheaper game ratings in Australia:

Game Assessment website

Wii code: 2263 4706 2910 1099

 Ew, programmer nerds!



there's more to setting up SQL then simply efficiency over file reading, how bout extreme ease of use? Sure I could write some code to parse up a file, but why bother when I can simply use a 1 line db query.



The only teeth strong enough to eat other teeth.