Luvac Zantor
Members-
Posts
18 -
Joined
-
Last visited
Never
Everything posted by Luvac Zantor
-
Let me clarify. I have a database that keeps track of football stats based on the weekly games. What ends up happening is that each player ends up with multiple entries based on the week they played. What I want to do is take all those entries, and create an output that adds all the stats. (ie. yards for week 1 and week 2 and week 3, etc..) I was wanting to avoid having to create ANOTHER table to store things in (seemed redundant, since I figure there must be a way to pull multiple rows and \"add\" them together) I\'ve been looking around for a few hours, but must be looking in the wrong place. (online and the PHP Bible). Suggestions? thanks!
-
Tough: How do I import a Text file that isn't standardized?
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
er... i guess you can\'t. -
Tough: How do I import a Text file that isn't standardized?
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
btw,,, in the text file, it doesn\'t WRAP like it is in the above example.... PASSING CMP ATT YDS PCT Kurt Warner 13 24 177 54 RUSHING ATT YDS AVG Garrison Hearst 34 138 4.0 Robert Holcombe 2 21 10.5 Kurt Warner 1 -2 -2.0 i shortened it so it doesn\'t wrap... but regardless, the importing is confusing me. -
Example: PASSING CMP ATT YDS PCT YPA SACK TD INT LONG RATING Kurt Warner 13 24 177 54 7.3 0 1 2 42 57.1 RUSHING ATT YDS AVG LONG TD FUM Garrison Hearst 34 138 4.0 21 1 1 Robert Holcombe 2 21 10.5 15 0 0 Kurt Warner 1 -2 -2.0 0 0 0 How do you import a file that isn\'t formated the same through out the file. The above is part of an entire file with multple headings, and I can\'t for the life of me figure out how to import the file. Suggestions?
-
number_format($result[Pct],0) ah ha!!! nevermind
-
Yeah i\'m looking now, but I figured If anyone browsing knew,,,, i\'d ask.
-
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
dang you were quick to respond.... I just guessed at using the fetch_array, which apparently is what you replied with. again, thanks for the help!!!!! -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
got it... I modified what you had slightly and it\'s working now $connection = mysql_select_db($database, $server); $sql = \'SELECT * FROM PASSING ORDER BY PASSING.Yds DESC LIMIT 0, 3 \'; $query = mysql_query($sql); $i = 0; while ($i < mysql_num_rows($query)) { $result = mysql_fetch_array($query); echo "Player is " . $result[Player] . "<BR>"; echo "Players yards are " . $result[Yds] . "<BR>"; $i++; } some changes probably not needed, but changed the internal num_row to fetch_array and it\'s doing what it should! THANKS FOR THE INSIGHT, it utterly helped me fix the problem. THANKS!!! -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
the page is displaying multiple lines with NO stats showing. -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
trying that now. I agree that it should work, you\'d think, but if my query is multiple lines,, doesn\'t work. I put it in one line, it works *Shrugs* Also the query works in phpmyadmin, which is why I was initially confused. btw, thanks for the help!!! -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
ok, how do I query the \"next\" row in an array? I tried mysql_fetch_row() but it failed.... -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
got it, my query has to be one line. I just put all the query info into ONE line, and it appears to be working now. -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
looks like my query is wrong.. too many lines maybe? regardless it works now as this.... $server = mysql_connect($host, $username, $password) or die(mysql_error()); $connection = mysql_select_db($database, $server); $sql = \'SELECT * FROM PASSING\'; $query = mysql_query($sql); $result = mysql_fetch_array($query); echo "Player is " . $result[Player] . "<BR>"; echo "Players yards are " . $result[Yds] . "<BR>"; It displays now, but how do I get it to display just the top 3 in yards? -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
thanks for the link looking now. -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
btw, if I use a query analizer..... the query DOES return information, so it\'s there.... -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
nope same error..... -
newbie question for php and mysql to return and DISPLAY info
Luvac Zantor replied to Luvac Zantor's topic in MySQL Help
this is the error I get Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/Zantor/public_html/af2/test.php on line 24 line 24 is $result = mysql_fetch_array(query); I noticed,, did you forget the $ before query? going to try that.. *shrugs* -
This is the code, pretty straight forward. $server = mysql_connect($host, $username, $password) or die(mysql_error()); $connection = mysql_select_db($database, $server); $sql = \'SELECT PASSING.Player, PASSING.Cmp, PASSING.Att, PASSING.Yds, PASSING.TD, PASSING.Ints\'; $sql .= \'FROM PASSING\'; $sql .= \'ORDER BY PASSING.Yds DESC LIMIT 0, 3\'; $result = mysql_query($sql); echo $result ?> I\'ve tried many variations, but obviously I\'m new and have no clue. I assume it\'s parsing, because I get a blank page (when I mess around with the query, i\'ll get errors). It\'s the damn blank page. Any suggestions? Thanks!