Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

aebstract's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. I have a string that is unformatted and has a lot of commas in it. How would I add a \n linebreak after every 4th comma?
  2. I have this in my .htaccess RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([[:alnum:]_]+)/$ /index.php?page=$1 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2&var2=$3 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/([[:alnum:]]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2&var2=$3&var3=$4 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/([[:alnum:]]+)/([[:alnum:]]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2&var2=$3&var3=$4&var4=$5 [NC,L] When I go to: url.com/Category/Intakes/ everything works fine url.com/Category/Motor Mounts/ I get 404 Not Found I know it's something to do with the space, cause I can manually type in anything without a space and it will go, anything with a space and 404. I'm unsure how to fix the regex to fix it though.
  3. Hello, I am not sure this is the correct location for this, but I think it is.. should be, hopefully. We have an inventory control software that has a firebird sql based database, we have the odbc driver installed. This is on a windows server 2008 machine on our LAN. I need to access the information in that database from our web host so that I can use inventory counts on our website. I've got some very slight ideas of what to do but I have never done anything like this and for the most part am lost. Would really really appreciate any help I could get!
  4. That's nice and all, but I don't know how to target only the sections that have similar ETs to switch, rather than sort the entire array.
  5. I have an array, and to make it easy let's say they have 2 values: ET and SPEED Here is an example chart of the array printed out: KEY ET SPEED 8 5.2 60 3 5.3 60 1 5.4 70 7 5.4 60 9 5.4 90 6 5.5 60 5 5.6 60 2 5.6 65 4 5.7 60 I need to take this array and each group that has a matching ET, put them in order based on SPEED. The corrected chart should be like this: KEY ET SPEED 8 5.2 60 3 5.3 60 9 5.4 90 1 5.4 70 7 5.4 60 6 5.5 60 2 5.6 65 5 5.6 60 4 5.7 60 Just not sure of how to only arrange the section that need to be. Keys stay the same, just the order changes.
  6. I'll give your code a try and take a look at it. I was referring to q1s, etc and used X as a variable for them, sorry about that. I wasn't even thinking to mention it but, q1 q2 q3 would be lowest, but it's weird how it works. There is a target, say 4.70. You're trying to get as close as possible to that without going under, which I have taken and sorted out by creating an indexH and indexL. I didn't mention the L because I can do the same thing with it as I do with the H. There are 3 qualifying passes, if you run a 4.71 and then your other passes go under 4.70, you're still in a top spot because of your "best" time being that above 4.70 but very close to it. Hope that makes sense. I threw your code in to my 'compare' function, it didn't seem to change the results. Here is a link so you can see the output: http://www.outlawracing.com/index.php?page=ladders&event=8 If you look under the class '5.30 index' I'm pretty bad with doing custom functions like this, but the bq is set as the "best qualifying time" and is the one that needs to be used for comparison against the others
  7. Oops! Forgot, this might help: function compare ($a, $b) { if (!array_key_exists('bq', $a) || !array_key_exists('bq', $b)) return -1; if ($a['bq'] == $b['bq']) return 0; return $a['bq'] > $b['bq'] ? 1 : -1; // switch to reverse the ordering }
  8. I've got a file that I haven't worked on in awhile and am needing to make a little change to it. Not too sure of how to do it though. The portion of the script I am looking at should be this: $indexH[$var][] = array('firstname' => "$r2[firstname]", 'lastname' => "$r2[lastname]", 'number' => "$r2[number]", 'id' => "$r2[id]", 'q1' => "$r2[q1]", 'q2' => "$r2[q2]", 'q3' => "$r2[q3]", 'q1rt' => "$r2[q1rt]", 'q2rt' => "$r2[q2rt]", 'q3rt' => "$r2[q3rt]", 'q1s' => "$r2[q1s]", 'q2s' => "$r2[q2s]", 'q3s' => "$r2[q3s]", 'regid' => "$r2[regid]", 'eventid' => "$r2[eventid]"); $ir = 0; foreach ( $indexH[$var] as $val ){ $q1 = $val[q1]; $q2 = $val[q2]; $q3 = $val[q3]; $var2 = substr($var,0,5); $var2 = substr_replace($var2, "0", 4, 1); if ($q1 < "$var2") { $q1 = '99.999'; } else { $q1 = $val[q1]; } if ($q2 < "$var2") { $q2 = '99.999'; } else { $q2 = $val[q2]; } if ($q3 < "$var2") { $q3 = '99.999'; } else { $q3 = $val[q3]; } if (($q1 == $q2) && ($q1 == $q3)) { $indexH[$var][$ir][bq] = "$q1"; } elseif (($q1 <= $q2) && ($q1 <= $q3)) { $indexH[$var][$ir][bq] = "$q1"; } elseif ($q2 <= $q3) { $indexH[$var][$ir][bq] = "$q2"; } else { $indexH[$var][$ir][bq] = "$q3"; } $ir++; } foreach ($indexH[$var] as $key => $value) { uasort($indexH[$var], 'compare'); } This is taking three dfferent values (q1, q2, q3) getting the best value of the three and then sorting the array based on the best value chosen. Now the addition. If two entries in the array have the same best value resulting in a tie, I need to compare their qXs from that best value, higher qXs gets put above the lower. X = 1,2,3 depending on which is best value. If any more information is needed let me know, sort of hard to explain.
  9. You don't have to redirect them to another script, you can just have it redirect them to the same page after you're done with what you're doing. Then you'll be there on a fresh page. Same concept I suppose, just doesn't use two separate scripts. if (isset($_POST[submit])) { do something }
  10. haha thanks, didn't realize it was that simple.
  11. I have a text file with a lot of lines. Need to make each new line in the text file a new part of an array so I can loop through and remove everything except the first 5 characters. Unless there is a way to just remove everything except the first 5 characters of each line, they will also need a comma added to the end of them. If I get them in an array I can do whatever I need though.
  12. Oh I didn't realize it would work like that, thanks.
  13. When you use the limit parameters in an explode function. ex: explode(" ", $something, -3); Is there a way to take your results and merge them to one variable. I'll have different amounts of results randomly. So I could have $var[0] - $var[5] or just $var[0] only. Wanting to turn the entire results range in to one, say just $var
×
×
  • 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.