Jump to content

MAtkins

New Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by MAtkins

  1. requinix you are correct. I'm using Notepad++ and the file is encoded in utf-8. I have determined that if I encode it in ANSI the problem goes away. If I encode it in utf-8 the problem reoccurs. I've since learned that to check for BOM look in the lower right hand corner of Notepad++. It should say utf-8 BOM. It does NOT say that. It says DOS/Windows utf-8 instead. So, after reading your post I investigated further. I found a setting in Notepad++ that allows me to save in utf-8 without BOM. That solved my problem. THANK YOU!!!
  2. I'm on HostGator shared hosting. The code in the file http://sizzelicks.com/Test2.php is *exactly* this (I copy & paste everything): <?php session_start(); ?> <html> <body> Testing </body> </html>
  3. I expected this. Thanks. But, nope. There is no other code, no space before the <?php nothing. What I posted above is exactly what is in the file. I tried attaching the file. They won't let me. You could just copy the code and publish it to your server and see what happens. I'm at a loss.
  4. I'm trying to start a session in a simple php file. I keep getting "Cannot send session cache limiter - headers already sent " Here's *all* the code: <?php session_start(); ?> <html> <body> Testing </body> </html> Here's the URL: http://sizzelicks.com/Test2.php
  5. I've finally solved this (right in the middle of corporate taxes - UGH!). Rick James on the MySql forum had it. He just looked at my query and saw what was wrong. You can't do 2 exclusive INNER JOINS on the same table. They'll just cancel each other out. You can't do LEFT JOINS on the same table either. You'll just get all records on the left side (ie relations). This gives me exactly what I need. I tested it and compared it to the actual scores & relationships. It's right. It even handles situations where there was no division and/or no team and/or no organization. All the averages are correct. I added the table organizations to be able to make 3 tiers. I've split the relations table up into multiple tables. rel_divisions_rl(RelationID, DivisionID) rel_teams_rl(RelationID, TeamID) rel_organizations_rl(RelationID, OrgID) If anybody knows how to make this faster without altering the results I sure would appreciate learning about it. SELECT divisions.RecordID AS DivisionID, teams.RecordID AS TeamID, (organizations.RecordID) AS OrgID, MAX(divisions.Division), MAX(teams.Team), MAX(organizations.OrgName), AVG(scores.Score) AS Score FROM scores INNER JOIN (((relations LEFT JOIN (rel_divisions_rl LEFT JOIN divisions ON rel_divisions_rl.DivisionID = divisions.RecordID) ON rel_divisions_rl.RelationID = relations.RecordID) LEFT JOIN (rel_teams_rl LEFT JOIN teams ON rel_teams_rl.TeamID = teams.RecordID) ON rel_teams_rl.RelationID = relations.RecordID) LEFT JOIN (rel_organizations_rl LEFT JOIN organizations ON rel_organizations_rl.OrgID = organizations.RecordID) ON rel_organizations_rl.RelationID = relations.RecordID) ON scores.RelationID = relations.RecordID GROUP BY DivisionID, TeamID, OrgID ORDER BY DivisionID, TeamID, OrgID
  6. Yes but it's really a kind of 'pseudo' hierarchy. I've gotta be able to do it backward also. The reports mean whatever they do to the client. We've discussed the potential ambiguity of the reports. Clients want what clients want . . . I'm working on corporate taxes, I'll get back with a new dump when I can. Thanks for replying:)
  7. I don't think I described it well enough. A person is asked a series of questions about a 'work' and answers them with a score. Truthfully, there are more than 2 tables. I used 2 just to simplify the problem here. (divisions, teams, projects, companies, etc.) My client, who sets up the questions can select as many of each entity as they want to represent the work. For example they may deem 2 divisions and 3 teams as 'attributed' to the work. Putting an FK into one of the 'entity' tables or the scores table won't help. There is no intrinsic connection between any of the entity tables. I have to produce reports a maximum of 3 tiers deep that show per tier what the average score was. For example: SW Division 9 Demolition Team 7 Ajax Department Stores 8 This report would indicate that for all scores that include the SW Division the score average is 9 For all Demolition Team scores within the SW Division the score average is 7 For all the Ajax Department Stores, within Demolition Team within SW Divsion the score average is 8. I have to be able to show it with any entity in any position. For example: Ajax Department Stores Demolition Team SW Division I have a sql dump but I'm not happy with the tables & records. I'll post it here when I've got something I think that will represent what I need. Thanks for the reply:)
  8. I've got 4 tables: divisions (ID, Division) teams (ID, Team) scores(ID, RelationID, Score) relatives (ID, RelationID, FieldID, ValID) The relatives table is to 'link' divisions and teams by RelationID The FieldID defines the table (1=divisions; 2=teams) The ValID = the ID of the given table. So, my fk is a combination of FieldID & ValID The output should look something like this: <pre> Southwest Division | Tomcats | 17 Southwest Division | Bears | 12 Northeast Division | Tomcats | 20 Northeast Division | Lions | 8 Northeast Division | Cheetahs | 13 Southeast Division | Cheetahs | 19 Southeast Division | Lions | 12 Southeast Division | Zebras | 6 </pre> Any given team can be in any division. My Sql is: <code> SELECT DISTINCT divisions.Division, teams.Team, AVG(scores.Score) AS Score FROM (answers INNER JOIN ((relatives INNER JOIN divisions ON relatives.FieldID = 1 AND relatives.ValID = divisions.ID) INNER JOIN teams ON relatives.FieldID = 2 AND relatives.ValID = teams.ID) ON answers.RelationID = relatives.RelationID) GROUP BY Division, Team ORDER BY Division, Team </code> This sql returns no records. Even if I remove the answers, GROUP and ORDER BY I get no records. How can I make the tables return what I need? I'd redesign the whole thing if needed.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.