Jump to content

WinnieThePujols

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by WinnieThePujols

  1. Red, See, if you look at the page in the browser versus a page using curl, it's actually quite different. Based on the source code, it looks like milb.com employs a ton of Javascript... the actual stats and tables themselves don't show up in the source code. The only thing you see in the source code itself is (presumably this is what prints the stats): <script type="text/javascript">writeData();</script> So what I'm thinking is: <script type="text/javascript">writeData();</script> EQUALS this image here. Not sure how I'm going to work-around that... Edit: also, about the copyright thing. I think that MLB has conceded that Players and Stats cannot be copyrighted, so do I actually need permission (if just using it for a non-profit site)?
  2. Can you elaborate on that a little bit? "Curl?" Is that like a function or what is it, exactly? Edit: nevermind, I Googled it. Thanks for the suggestion -- I'll look into it!
  3. How do I go about collecting data from another website? Basically what I'd like to do is set up nightly retrieval of data from this site: http://web.minorleaguebaseball.com/milb/stats/stats.jsp?n=Jarrett%2520Hoffpauir&pos=&sid=milb&t=p_pbp&pid=459440 (and other pages on that site) And then have it input into a database on my server. I'd basically want to read everything on that page as a string, and then explode pieces of it into individual chunks that would then be added to a MySQL database... I have no idea where to even start. I asked someone in the past and he called it a "grepper" or something. Can someone please assist me in getting started? In a nutshell... how do I set up automatic retrieval from a separate site? Thanks for the help.
  4. OK, I've been messing around and... if($name == "[player]Scott Rolen[/player]") {     print "Same"; }else{     print "Not"; } ...that returns "Same.."
  5. [color=red]Replace your single quotes when double ones and you'll have your answer...Problem solved. God I'm stupid.[/color] I'm coding a baseball site. I want my users to be able to have a custom tag called player. Basically, they'll type something like [player]His Name[/player], and the two tags will be replaced to a link; a query to the database will be made, his player ID will be found and the correct link will be added. However, for some reason, I always seem to run into this problem when doing a str_replace... Check this out: $name = "[player]" . $first . " " . $last . "[/player]"; When I print that, I get: "[player]Scott Rolen[/player]" (minus the quotes); a strlen tells me it's 28 characters. If I try and substr_count($var, '$name'), I get nothing. However, if I go: substr_count($var, '[player]Scott Rolen[/player]'), it "works". For the heck of it, I did: $test = "[player]Scott Rolen[/player]"; $code = strlen($test); print "<br>$code"; Not surprisingly, that prints out to be 28 characters -- the same as the other one. The original string is: this is a test [player]Albert Pujols[/player] and there is also [player]Scott Rolen[/player] and there is also [player]Jim Edmonds[/player] So can someone please explain THIS: $name = "[player]" . $first . " " . $last . "[/player]"; // printed it equals "[player]Scott Rolen[/player]" $NUMBA = substr_count($var, '$name'); // printing $NUMBA results in a gooseegg (0) $OTHER = substr_count($var, '[player]Scott Rolen[/player]'); // printing $OTHER results in 1... This has to be some common problem or something... help! What am I doing wrong? PS: it's probably a typo if something doesn't matchup as the same... I'm 99% these are the exact same strings (or at least LOOK the exact same when printed out).
  6. I'm thinking maybe my host did something? I don't know what, though. I emailed them asking how I could get access to browse the area where the MYI files would be... they never replied, though. Regardless, I've started doing the occasional backup of my databases so that if it DOES happen, I'll at least be somewhat protected.
  7. It's funny that you say that... the reason I edited the post was just because I didn't feel it was relevant at all. I can't even remember what I posted. I tried doing a lot of different things... I tried backing up the database into a text file hoping there would be just "raw" data, but it was completely empty. You wanna hear the strangest part? Today it randomly fixed itself. I honestly have no clue what happened... I like it, though! Thanks, fenway, for your help. Any time I come here you always lend a helping hand. How this fixed itself I do not know (I checked last night and it wasn't working, but when I got off work tonight it was fine... maybe my host did something?), but it's a nice surprise... it saved me a lot of work!
  8. Edit: nevermind. I can't figure out how to delete this post.
  9. I think they somehow became views when they were messed up... I know I created every table the same way... so in theory, they all should have been the same type. I'm wondering if there was a known problem where problem X somehow causes tables to change into a view or something.
  10. Do these screenshots help whatsoever? [img src=\"http://img124.imageshack.us/img124/4509/picy8uk.jpg\" border=\"0\" alt=\"IPB Image\" /] And this... [img src=\"http://img79.imageshack.us/img79/8599/picx1dd.jpg\" border=\"0\" alt=\"IPB Image\" /] Sorry if they're big.. but they just show up as "views." I'm guessing that won't help at all, but I thought it was worth a try.
  11. See I'm reading up on this, but I don't understand why the USE_FRM repair doesn't work. This is from the MySQL site: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]There is also a USE_FRM mode available for REPAIR TABLE. Use this if the .MYI index file is missing or if its header is corrupted. In this mode, MySQL re-creates the .MYI file using information from the .frm file. This kind of repair cannot be done with myisamchk. Note: Use this mode only if you cannot use regular REPAIR modes. The .MYI header contains important table metadata (in particular, current AUTO_INCREMENT value and Delete link) that are lost in REPAIR ... USE_FRM. Don't use USE_FRM if the table is compressed because this information is also stored in the .MYI file.[/quote] Given that I'm getting the missing "06draft.MYI" error, I'm kinda at a loss as to why this isn't working.
  12. [b]Attempt #1: [/b] [img src=\"http://www.cardsbaseball.net/Clipboard01.jpg\" border=\"0\" alt=\"IPB Image\" /] [b]Attempt #2: [/b] [img src=\"http://www.cardsbaseball.net/error2.jpg\" border=\"0\" alt=\"IPB Image\" /] I don't know what to do! ;_;
  13. [!--quoteo(post=379234:date=Jun 1 2006, 09:30 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 1 2006, 09:30 PM) [snapback]379234[/snapback][/div][div class=\'quotemain\'][!--quotec--] Wiped out how? The MYD files didn't vanish, right? If the index is corrupted, that can be fixed. Please clarify. [/quote] "SELECT * FROM recaps r;" returns.. [img src=\"http://img85.imageshack.us/img85/3728/error8tf.jpg\" border=\"0\" alt=\"IPB Image\" /] I guess I don't know how to answer that. Where are the MYD files stored, phsyically-speaking? I don't know how to check that through like an FTP. I've always used GUI programs like the Query Browser so I don't really know. But anyway, the screenshot it when I try to query the table and get all of the rows.. and it says it can't be executed. Edit: Well, I dd some looking into it. It says that if other repair methods don't work (a missing .MYI) I could try this: REPAIR TABLE literature.06draft USE_FRM Unfortunately, it doesn't work... it errors out!
  14. For some reason, two tables from the same database where completely wiped out. I have no idea how this happened. There were other tables in the same database that were completely unaffected... I do know that one guy had access to both of them (and would have been the most recent to use them), but he would have had no malicious intent and is no where near saavy-enough to have done anything... and any access he had to them would have been purely through web-based applications that I made for him. He can only add stuff through them, too... he can't delete. Any idea what could have happened? When I run... "SELECT * FROM literature.recaps r;" In the query browser, I get: "The query could not be executed." And just beneath that part is.. "! Can't find file: 'recaps.MYI' (errno: 2) Thanks for the help. Not really a big loss if these are gone, but I'd like to know what could have went wrong so I can prevent anything like that from happening again.
  15. [!--quoteo(post=365438:date=Apr 16 2006, 10:10 PM:name=ypirc)--][div class=\'quotetop\']QUOTE(ypirc @ Apr 16 2006, 10:10 PM) [snapback]365438[/snapback][/div][div class=\'quotemain\'][!--quotec--] If you are using unix timestamp and the field is an int and you order by it, it WILL come out in order. [/quote] OK, I have a text field instead of int. Could that be causing the problem, or don't you think that would throw it off? I changed it to INT and it worked. Thanks a lot for the help guys, I appreciate it.
  16. [!--quoteo(post=365424:date=Apr 16 2006, 09:02 PM:name=ypirc)--][div class=\'quotetop\']QUOTE(ypirc @ Apr 16 2006, 09:02 PM) [snapback]365424[/snapback][/div][div class=\'quotemain\'][!--quotec--] Well you pasted that when you were retrieving the data it was coming out as And that is not how a unix timestamp looks. Also, as Barand mentioned, which I overlooked, if the person was born before 1970, the unix timestamp won't work for them. [/quote] It's because before that loop, I did this: $birthday = $testRow["info_birthdate"]; $bd = date("m.d.y", $birthday); print $bd; I'm just saying that I order by info_birthdate, the dates didn't come out in order...
  17. [!--quoteo(post=365391:date=Apr 16 2006, 03:34 PM:name=ypirc)--][div class=\'quotetop\']QUOTE(ypirc @ Apr 16 2006, 03:34 PM) [snapback]365391[/snapback][/div][div class=\'quotemain\'][!--quotec--] Store the date in a unix timestamp. [/quote] Yeah, but I am, aren't I? [code] $birthday = strtotime($birthday);               $add_player =mysql_query("INSERT INTO `player_info` ( `info_id` , `info_first` , `info_last` , `info_position` , `info_level` , `info_country` , `info_birthdate` , `info_height` , `info_weight` , `info_throws` , `info_bats` , `info_experience` , `info_number` )VALUES ('', '$f_first', '$f_last', '$f_position', '$f_level', '$f_country', $birthday, '$height', '$f_weight', '$f_throws', '$f_bats', '$f_experience', '$f_number')");[/code] Isn't that storing it as a UNIX Timestamp? (The type of info_birthdate is just text, I think.)
  18. [!--quoteo(post=365385:date=Apr 16 2006, 04:16 PM:name=ypirc)--][div class=\'quotetop\']QUOTE(ypirc @ Apr 16 2006, 04:16 PM) [snapback]365385[/snapback][/div][div class=\'quotemain\'][!--quotec--] I suggest storing ALL dates in an int field using unix timestamp. It makes it _much_ easier to manipulate the date at a later time. You might also want to check out [a href=\"http://us3.php.net/strtotime\" target=\"_blank\"]http://us3.php.net/strtotime[/a] [/quote] OK: so instead of a DATE field, I make that INT? And then I just take the $birthdate variable and strtotime it? See, I think that's what I'm using now. And then I use this query: mysql_query("SELECT * FROM player_info ORDER BY info_birthdate DESC"); But then when I print out the $birthdate's in a loop, they aren't in order. How do I remedy this problem? Eg: part of the loop looks like this: Date: 02.11.72 Date: 01.21.72 Date: 08.15.81 Date: 10.01.80 Date: 09.09.79 Date: 08.23.79 Date: 05.23.79 Date: 03.31.79 Date: 03.03.79 Date: 02.24.79 Date: 02.24.79 Date: 08.14.78 Date: 06.10.78 Date: 04.18.77
  19. I'm starting to get really frustrated, folks! Let me start by describing what I'm trying to do. All I want is to have my staff members input the birthdate of a baseball player, and then have it stored in a DATE field in a MySQL table entitled "player_info." I have other areas on the site (like the Articles section) in which I store dates and it works fine. The difference is that I use NOW() instead of a user-inputted date. Now, to make sure they use the correct format, I broke the date down into three fields: month, date and year. So I combine those three variables when the form is processed, and create one new variable called "$birthdate." It's the the format YYYY-MM-DD. So what do I have to do with $birthday before I insert it into the DATE column in the table? Because when I try and insert it the way I have now, it just shows up as 0000-00-00. What do I need to change to get it to work? And then when I pull it out from the database, what do I have to do to format it correctly? Do I need to use UNIX_Timestamp or something? One guy in particular told me to use that. I want to be able to sort by birthdate when I query the database, but my current method is not working. I cannot, for the life of me, find a turotial that handles this. Everyone I see uses NOW() and never uses a custom date. Please help -- it would be much-appreciated!
  20. I found out what I was doing wrong. I had it like this: print $conRow['$tempVal']; But I guess with the half quotes around $tempVal it was using the name of the variable, as opposed to the value of it! Doh! Thanks people.
  21. Alright, I'll try and explain this as best I can. I have baseball player's contracts listed in a big database. The years of their contract are listed in under columns entitled "contract_byr1," "contract_byr2," (etc) all the way up to "contract_byr10." Also, there's another column called "contract_length." Now, I call to the SQL database using... $conRow = mysql_fetch_array($getContract); $totalYears = $conRow['contract_years']; Now, once it comes time to display the salary, I have a for loop set up like this: for($displayYear = '1'; $displayYear <= $totalYears; $currentYear++) OK, I tried using this code within the aforementioned loop: print "Year $displayYear salary: " $curConYear = "contract_byr$currentYear"; $tempSalary = $conRow['$curConYear']; print $tempSalary; Unfortunately, it doesn't return any value... so clearly something in the above code listing is wrong! I'm 99% sure the "$conRow['$curConYear']" method doesn't work, so what alternatives do I have? When it outputs, it basically looks like this: Year 1: (nothing) Year 2: (nothing) etc... Thanks, your support is much appreciated!
×
×
  • 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.