Jump to content

RichieW13

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by RichieW13

  1. I am still very much a beginner in writing php code and using mySQL databases. In order to teach myself more, I'm building a project (in my mind so far) to teach myself some skills. What I want to do is create a little site for my fantasy football league. Basically, I want to upload the player scores each week so that I can use the data to write various reports (high point scorers, etc.) So each week I'll want to upload to my database the points scored for each player (there will be 140 players to upload each week). Each player will be in the database and have a unique number to identify them. So what would be the best way to upload the data? I guess I will write a PHP form to input the data manually, but how do I associate the unique ID for each player so that his data for each week get associated with his row in the PlayerID table? Do I have to create a dropdown list of all players in my database, and then pick him? That seems like a slow way to go.
  2. So does that mean I should actually end each row with \n in the text file? like this: 2004,Ford,Escort,150000 miles\n
  3. Is there any limit to the length of an array element in a flat data file? For instance, I have a flat file that I might end up having 200 rows, with each row containing 15 elements. Most of the elements will be about 20 characters or less, but a couple of the elements might be 300-400 characters. I'm guessing there is no limit. And since each row will be longer than one "line" in a .txt file, how best to mark the end of a row? [i assume that using a database is probably the better way to do this, but on this particular website I'm working on that isn't an option.]
  4. Thanks for the help. I had a little trouble figuring out what you did here: $lines = file(file); before realizing that it should be: $lines = file($file); (Just in case anybody else is using this tip.)
  5. I have a simple text file called bio.txt: wohlersr; Richie Wohlers; Intermediate; Four Aces meyersg; Greg Meyers; Novice; Four Aces I wrote a little script, to return the info for Greg Meyers if the user id is correct, or say "Member not found" if incorrect. For some reason, my output is giving me both. I assume it's a context error, but can't figure it out. Here's my script: <?php $file=file("bio.txt"); $count=count($file); $i=0; while($i<=$count) { $row = explode(";", $file[$i]); $id = $row[0]; $name = $row[1]; $class = $row[2]; $club = $row[3]; if($id=="meyersg"){ echo $name."</br>"; echo $class."</br>"; echo $club."</br>"; }else{ echo "Member not found."; } $i++; } ?> And here's the output I'm getting: Member not found. Greg Meyers Novice Four Aces Member not found.
×
×
  • 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.