Jump to content

Monckey100

Members
  • Posts

    9
  • Joined

  • Last visited

Monckey100's Achievements

Newbie

Newbie (1/7)

1

Reputation

  1. alright thank you, if I have any problems I'll be sure to post back
  2. perfect!! How would I go about reading the file now? I understand I wouldn't just place an explode...
  3. $line .= $matrix[$i][$x] . ($x < sizeOf($matrix[0]) ? "," : "\r\n") ; // credits to astralaaron still nothing :|
  4. okay great, I opened it in wordpad,notepad and microsoft word, the \n's don't seem to be registering
  5. It doesn't seem to parse as intended, instead it goes xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxinstead ofxxxxxxxxxxxxxxxxxxxxxxxx but I guess it's not that big of a deal, any idea how I would go about reparsing it back into the matrix?
  6. $matrix[10][10] = "hi";$file = fopen('file.txt', 'w');if(isset($_POST['mapname'])){for($i = 0; $i < sizeOf($matrix); $i++) {$line = ""; for($x = 0; $x < sizeOf($matrix[0]); $x++) { $line .= $matrix[$i][$x] . ($x < sizeOf($matrix[0]) ? "," : "\n") ; // edit 2 } fwrite($file, $line);}} The code looks like this but it yields 0 bytes the text file....here's the rest of the code that is being used to put values into the matrix. <form method="post" action="<?php echo $PHP_SELF;?>"><table><tr><td>Item tree:</td><td><INPUT TYPE="Text" name="items"></td></tr><tr><td>Map Name:</td><td><INPUT TYPE="Text" name="mapname"></td><td><INPUT TYPE="submit" value="save"/></td></tr></table><table border=1 width=100%><?php$matrix[10][10] = "hi";$file = fopen('file.txt', 'w');if(isset($_POST['mapname'])){for($i = 0; $i < sizeOf($matrix); $i++) {$line = ""; for($x = 0; $x < sizeOf($matrix[0]); $x++) { $line .= $matrix[$i][$x] . ($x < sizeOf($matrix[0]) ? "," : "\n") ; // edit 2 } fwrite($file, $line);}}for ($i = 0; $i <= 10; $i++){echo'<tr>';for($r =0; $r <= 10; $r++){ echo'<td><INPUT TYPE="Text" name="$matrix[$i][$r]" value="empty" size="10%"></td>';}echo'</tr>';}?>
  7. Monckey100

    sha1 usage

    I'm surprised no one mentioned this but you can use sha1 to compare file sizes and even do some sort of spider crawl on your site to compare for duplicate images.also if you sha1 the users, usernames then you wouldn't be able to do simple calls like "Welcome Monckey100!, settings, about" Etc
  8. Minor detail but spacing always helps you quickly read through code if tabbing is not available
  9. so I've figured out how to read an array and place it into a file with a single array...$matrix[10] and have it save onto a file all of the data with a new line per databut it gets kind of unnecessary and messy, however it's still readable. When it comes to $matrix[10][10] it becomes UNREADABLE, basically what I do isrun it through [0][0-10] and then [1][0-10] etc until its done all the values which isfine because its reparsable but for convenience I want it so I can quickly edit the numberson the txt file. ex:1,1,2,3,5,6,7,2,4,62,4,5,6,7,8,5,3,1,3 instead of112356724624...etc I want some form of code that can easily parse onto a text file and read it, I haven't posted my code because I like to implement the code in myself to have it work efficiently Here's what I have tried which has...failed.. $matrix [10][10];if(isset($_POST['mapname'])){$file = fopen('file.txt', 'w');foreach($matrix as &$array){fwrite($file, $array ."\n". '');}} P.s. Excuse my informality, I've been quite stomped and I apologize for the lack of an introduction thread. Edit: Changed the first line, it was creating a syntax error
×
×
  • Create New...