Gossamer Forum
Home : Products : DBMan : Customization :

Some Odd Questions :) Part 3!

(Page 2 of 2)
> >
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Missing right brackets are a real pain to find.

Post your html.pl file and I'll find the missing bracket. (I know where to look. Smile )


------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

Here ya go!

www.warningtrack.net/rosters_html_pl.txt

Chris

[This message has been edited by TWTCommish (edited May 09, 2000).]
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Your bracket problem is my typo.

It should be

Code:
my ($status2,@hits2) = &query("view");

A ( instead of a { before "view."

I'm unclear on what you're doing here, though.

------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

Unclear? Well basically I'm trying to print out all players who's value in the team field is equal to "Pittsburgh Pirates"...I'm trying to print them out in this format:

Kendall, Jason - Pittsburgh Pirates

I made your change, and then changed the "&" in front of the view command to a "@"...that got rid of the error message!

But then I got this one:

Code:
CGI ERROR
==========================================
Error Message : fatal error: Can't locate object method "Pittsburgh" via package "Pirates" at ./rosters_html.pl line 552.

Script Location : /usr6/home/warningt/public_html/cgi-bin/stats/db.cgi
Perl Version : 5.00503
Setup File : rosters.cfg
User ID : admin
Session ID : admin.95788714635335

I think I misunderstood this line:

Code:
$in{'Team'} = Pittsburgh Pirates;

How's that supposed ta work? Smile We're pulling info from the players db...

Chris Smile
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
You need to have the & in front of query. That tells the script to use a subroutine. If you have an @ in front of query, it means that there is an array by the name of query. You won't get anything from that.

Regarding "Pittsburgh Pirates":

You'll notice that in the code I gave you, it says

$in{'TeamID'} = the variable that holds the team name[\i];

This should be something that starts with a $.

If you want to test this using a specific team, you'll need to put the team name in quotation marks.

$in{'TeamID'} = "Pittsburgh Pirates";

What I'm trying to figure out is how you are getting to this point.


------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

Earlier you gave me some code to insert, and I saw this line:

Code:
$in{'TeamID'} = the variable that holds the team name;

It seemed logical to put the team name there...I don't have any field called "TeamID"...the TeamID field would be in the seperate DB I'm working on...totally un-related to this one.

I've got a rosters.cfg, rosters.db, rosters.count, and rosters_html.pl, I'm just trying to set it up so when you go to view a record, it'll find all the members of a certain team from the players DB, and print em out.

I'll tinker with it for a bit and let you know what happens.

Chris
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
I understand that you want to print out the names of the players for each team.

I see what you're doing now. You're using db=roster in your URL. Okay.

What is the name of the field in the players.db that holds the name of the team?


------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

Oh I think I see now!

The field for the team is called "Team" (how appropriate, eh?) Smile

Chris

P.S. If it helps at all...I've created a field both in the players.cfg file and rosters.cfg file called "RosterID"...just in case we need it...
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Ah-ha! Smile

Then you need to change the reference to 'TeamID' to be 'Team'. Smile

I'm not sure you're going to need the other field, but I'm sure it doesn't hurt to have it.

I'm going ahead with what I was going to do before. I think I may even have a way to work out the teams that have moved. But I'll really concern myself with that later.

For now, I need to get some real info to put in for testing purposes. Off to your current site for baseball stats. Smile


------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

I did that, but got an error message:
Code:
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: Can't use subscript on subroutine entry at ./rosters_html.pl line 527, near ""view"}"
(Did you mean $ or @ instead of &?)

Thats what originally prompted me to change the "&" Smile

Here's the code I've got:
Code:

undef %in;
&switch_to_players;
$in{'Team'} = "Pittsburgh Pirates";
$in{'sb'} = 2; # Change to the number of the field you want to sort by
$in{'mh'} = 100; # To make sure you get them all
my ($status2,@hits2) = &query{"view"};
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
print "<table>";
for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print "<TR><TD>$rec2{'Last'}, $rec2{'First'} - $rec2{'Team'}</TD></TR>";

}
print "</table>";
}

I may not know much about this, but to me it looks like the code I've got there now really ought to work...

Chris
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
You changed the wrong bracket. Smile

It should be

Code:
my ($status2,@hits2) = &query("view");

instead of

Code:
my ($status2,@hits2) = &query{"view"};

Those brackets are really hard to read sometimes -- hard to tell the difference between them. This is the one thing I don't like about Perl, but I don't know if there's any way anybody could change it.


------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Chris:

I would think for this line:

$rec2{'Last'}, $rec2{'First'} - $rec2{'Team'}

you would need to put it in a print statement such as:

print "$rec2{'Last'}, $rec2{'First'} - $rec2{'Team'}";

Also you have opening and closing table tags so perhaps you want it to be:

print "<TR><TD>$rec2{'Last'}, $rec2{'First'} - $rec2{'Team'}</TD></TR>";

Hope this helps Smile
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

My apologies, I should have posted that right away! Smile

Here's the URL for the html file:

http://www.warningtrack.net/rosters_html_pl.txt

Here's where the error is:

http://www.warningtrack.net/...ts/db.cgi?db=rosters

Sorry again!
Chris
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Now don't you start apologizing!! Smile

You still have the wrong syntax for

my ($status2,@hits2) = &query("view");

You have

my ($status2,@hits2) = &query{"view"};

It needs to be parentheses rather than curly brackets. (Possibly it will be easier to see the difference if I don't use the [code] tags.)

I do seem to be a little on edge today. I got sleep last night. That must be the problem! Smile

------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

Error gone! However the info still doesn't display on the record page...everything looks okay...is this line a problem?:

$in{'Team'} = "Pittsburgh Pirates";

Chris
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
The way to find out what's wrong it is to add a line.

Before

if ($status2 eq "ok") {

add

print $status2;

See what it says.

(I've been working on this myself and I have the Dodgers done -- well, I still need to add some stats for at least one player so you can see how it will work. As soon as I get it finished, I'll put it up on my site and you can have the code if you want it.)


------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

It says "no matching records"...is there something wrong with me specifying Team = Pittsburgh Pirates? Did I miss a bracket/quotation mark? Smile

Working on the Dodgers thing? Not sure what you mean...you mean a way to store stuff in a records/awards DB where it will recognize the Brooklyn Dodgers as the LA Dodgers, or the Senators as the Rangers, which would be, say, pulled into this team DB I'm workin' on?

Chris
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
If you're getting "no matching records" the script couldn't find anything with "Pittsburgh Pirates" in the Team field.

If you had missed a bracket or a quotation mark, you would be getting an error.

Hang on just a little longer. I'm getting things set up to look almost exactly like your site. (Not the left border background, but the way you have the info displayed.) And, yes, I think I've come up with a way to account for the team name/location changes as well.

I do enjoy relational databases. There are very few times when I can work with something this complex, though. It's fun. Smile

I'll let you know when there's something you can see. There's a little more I need to do first.

------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Ok, sounds cool! I'm SURE that there's the value of "Pittsburgh Pirates" in that field somewhere, though. I'm baffled.

Chris
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
It's not complete by any means, but there's something for you to see at http://www.jpdeni.com/...inks&uid=default .

Select Dodgers -> Player Profiles -> Shawn Green

That's all I have right now -- that and the Dodgers links. Let me know if this is what you want.

(Of course, it ain't very pretty, but I'll leave that up to you. Smile )


------------------
JPD






Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

Wow! You must have put a lot of time into that! Smile

It's very close to what I was thinking of. Would it still allow me flexibility over the team page layout, etc? I was originally planning to have a teams DB, which would have links to other DBs...like a roster DB, schedule DB, etc. It looks to me like this would be possible here!

The tricky part (I think) now is trying to show me how to get this stuff on my server now! Because even after looking at it I can't totally figure out what it is you've done to pull info from the players DB onto the roster one!

Very impressive work.

Chris
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

I logged in as an admin to try to figure it all out, but couldn't add a record to test it...says my LinkID and TeamID were left blank..? Smile

Chris
Quote Reply
Re: Some Odd Questions :) Part 3! In reply to
Carol,

I'm gonna start yet another thread...this one's huge! Smile

Chris
> >