# aebstract

Members

1,105

• Gender
Not Telling

0

1. ## Issues with isset

//\$n=\$_POST['t']; because you have // in front of it?
2. ## sorting numbers

It's not homework. It's just for a game online, for fun. It does give you a list of numbers in a row, and \$n is the number of numbers that are in that row. I've solved the game through the code I have, but now I'm trying to shorten it as much as possible and use better methods to accomplish the task. It's just a fun learning thing, and can be done in any way you choose. The code I provided was the way I solved it, but I know there are other possibilities and better options which is why I'm looking for help on some of it. I don't really know why I would need \$n, unless like you said to go through that many iterations instead of pulling in all numbers. I know it mentions in the instructions something about it pulling in all numbers and that you can change it. I have tried to look in to the STDIN and those functions being used (they were provided to begin the game basically) but haven't found anything that really makes me understand how it's working. I tried the fscan code and it makes my code fail every test case, even though I'm not calling \$n anywhere in my code. So I'm kinda lost as to what fscan is really doing I guess. Here is the entire game: Rules Write a program that prints the temperature closest to 0 among input data. If two numbers are equally close to zero, positive integer has to be considered closest to zero (for instance, if the temperatures are -5 and 5, then display 5). Game Input Your program must read the data from the standard input and write the result on the standard output. Input Line 1: N, the number of temperatures to analyze Line 2: The N temperatures expressed as integers ranging from -273 to 5526 Output Display 0 (zero) if no temperatures are provided. Otherwise, display the temperature closest to 0.
3. ## sorting numbers

<?php fscanf(STDIN,"%d",\$n); \$t = explode(" ", stream_get_line(STDIN, 256 + 1, "\n")); ?> This is how I get my original array, I don't have access to the source numbers beyond this. I'll play around with what you posted and see if I can figure something out.
4. ## sorting numbers

Because I don't know how to do a check to determine the correct option like that.
5. ## sorting numbers

An output of the array would look identical to what I showed as an example. Basically trying to find the closest value to 0 and if the closest value is the same positive and negative like -2 and 2, I need to output the positive.
6. ## sorting numbers

I have an array of numbers, something like: 1 > 5 2 > 10 3 > -2 4 > -6 5 > 3 I need to sort this array so that it is in numerical order IGNORING the negative signs. A correct ouput would be this order: -2 3 5 -6 10 Right now I am having to basically duplicate my array and then use str_replace to remove the - and then sort the list keeping my keys in tact with the values, that way I can go back and compare to my original array. I could use one array and do away with all of the extra if I knew a way to do this sort. Thanks in advance!
7. ## Undefined Offset: 0

[sat Mar 06 12:53:51 2010] [error] [client 202.75.211.90] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:) [sat Mar 06 12:56:10 2010] [error] [client 211.155.228.169] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
8. ## Undefined Offset: 0

<?php error_reporting(E_ALL); ini_set("display_errors", 1); include_once "connect.php"; \$textData = file('array2.txt'); echo "\$dataArray"; ?> This displays a blank white page. No errors to be seen.
9. ## Form- Text area content (characters) limit

Are you talking about <textarea> ? Definitely not a php question, but I'm fairly sure it doesn't have a character limit.

11. ## Counter script not working

What's it doing wrong/different when you have full php tags?
12. ## Undefined Offset: 0

[sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 48 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 49 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 50 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 51 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 52 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 53 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 54 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 55 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 56 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 57 This is a continuation of the other post, though the memory issue has been taken care of. How does an undefined offset: 0 error come up? I need to get it fixed. Here is my entire script I am running: <?php error_reporting(E_ALL); ini_set("display_errors", 1); include_once "connect.php"; \$textData = file('array2.txt'); \$dataArray = array(); \$tempArray = array(); \$array_start = false; foreach (\$textData as \$line) { if (\$array_start && preg_match("/\[([^\]]*)\] => (.*)/", \$line, \$keyValue)!= 0) { \$tempArray[\$keyValue[1]] = \$keyValue[2]; } if(substr(\$line, 0, 1)=='(') { \$array_start = true; } if(substr(\$line, 0, 1)==')') { \$array_start = false; \$dataArray[] = \$tempArray; \$tempArray = array(); } } \$arraycount = count(\$dataArray); for (\$i = 0; \$i <= \$arraycount; \$i++) { \$dataArray0 = \$dataArray[\$i][0]; \$dataArray1 = \$dataArray[\$i][1]; \$dataArray2 = \$dataArray[\$i][2]; \$dataArray3 = \$dataArray[\$i][3]; \$dataArray4 = \$dataArray[\$i][4]; \$dataArray5 = \$dataArray[\$i][5]; \$dataArray6 = \$dataArray[\$i][6]; \$dataArray7 = mysql_real_escape_string(\$dataArray[\$i][7]); \$dataArray8 = \$dataArray[\$i][8]; \$dataArray9 = \$dataArray[\$i][9]; \$dataArray10 = \$dataArray[\$i][10]; \$dataArray11 = \$dataArray[\$i][11]; \$dataArray12 = \$dataArray[\$i][12]; \$dataArray13 = \$dataArray[\$i][13]; \$dataArray14 = \$dataArray[\$i][14]; \$dataArray15 = \$dataArray[\$i][15]; } ?> The errors I got were sent to me from my web host, I get a solid white blank page.
13. ## max file size with file() ?

I got an email from my host and he said this is the error that was being displayed: [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 48 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 49 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 50 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 51 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 52 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 53 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 54 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 55 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 56 [sat Mar 06 12:03:07 2010] [error] [client 12.248.157.94] PHP Notice: Undefined offset: 0 in /var/www/vhosts/outlawracing.com/httpdocs/insert.php on line 57
14. ## max file size with file() ?

Okay, I have my memory_limit set to 100M now, I am getting now errors but am still getting a blank white page. I have an echo statement ABOVE my file() and it isn't getting displayed either. Could something in the file be causing it to do this? If so, what would trigger such an event? Wouldn't I still get information up until the point that it causes error? The smaller file still works, the larger one is just blanking out.
15. ## max file size with file() ?

I placed this at the top: error_reporting(E_ALL); ini_set("display_errors", 1); but, with the .htaccess fix I mentioned above, I'm not getting an error just white space. I could do it one line at a time, but not too sure where to start as to write that, as right now I have a little function to do some array work so I can loop through every value and insert it in to the database. This is going to be a one time access deal, then it will be trashed and never ran again.
×
×
• Create New...