Jump to content

chaking

Members
  • Posts

    68
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

chaking's Achievements

Member

Member (2/5)

0

Reputation

  1. wow yeah - I should have thought of that too - I'll have to check if that matches up consistently tomorrow. Thanks for the follow up
  2. hmm... good idea, however I don't know if that would work... e.g. take this record: Month: 3 Day: 0 Week: 5 Timezone: Azores Daylight Savings Time I believe this references the last sunday in March... if we were to do (5*7)+0 = 35th day of March?
  3. I'm working on daylight savings time around the world and the database I'm drawing the information from lists the start of daylight savings time with the month, day, week, hour, minute and second it starts. Initially I thought I could throw that information into mktime() and get the timestamp, however once I started doing it I realized the `week` part screws it all up. mktime is setup as mktime (hour, minute, seconds, month, day, year) So you can't add in the week of the month. So if I have the following information, anyone know how I can get a timestamp?: Month: 11 Day: 0 Week: 1 Hour: 2 Minute: 0 Seconds: 0
  4. I'm trying to match a few things here and I'm getting a little confused - any help would be appreciated: $s = "SELECT DISTINCT DEVID, INPUTDEVID, MACHINE FROM EVENTS WHERE (EVENT_TIME_UTC BETWEEN '".$start."' AND '".$end."') AND ((EVENTTYPE = 0 AND EVENTID = 0) OR (EVENTTYPE = 4 AND EVENTID IN (2,8,10,53,413,431))) AND (MACHINE = ".$machine.")"; So I'm trying to find any event that has an eventtype of 0 AND an eventid of 0... OR any eventtype of 4 and eventid in (2,8,10,53,413,431). I do NOT want an eventtype of 4 and an eventid of 0. I'm getting a bit confused on how to convey this in the sql statement. I thought I could separate it with parentheses and that would do the trick, but I'm not so sure Any suggestions?
  5. Thanks! Do you happen to know the process behind those functions? I'd be interested to see how it's actually broken down
  6. Ok, so I know how to convert an IP address into an integer... like so: IP: 10.11.12.13 $a = 10 $b = 11 $c = 12 $d = 13 ($a * 256 to the third) + ($b * 256 squared) + ($c * 256) + ($d) = the integer or ($a * 16777216) + ($b * 65536) + ($c * 256) + ($d) = the integer Now, how do you take the final integer and and convert it back to a regular ip address with decimals and all?
  7. The array is something like: <?php $a = array(1,0,1,0,1,0,0,1,1); ?> Is there a way to evaluate the array to see if 2 1's are consecutive? Or if this is easier to read: <?php $a = array("IN","OUT","IN","OUT","IN","OUT","OUT","IN","IN"); ?> I'm trying to execute code anytime 2 INs are consecutive. This might not be the best way to go about it, but basically I'm trying to determine if something was done before it's other required action has been completed. So I query the dB and select all of its events in order of the time of the event, and then output it into an array so that I can tell if the proper conditions were met. If there were 2 INs before an OUT, then that's a problem and needs to be echoed out...
  8. The answer is in the sql statement... so instead of grabbing the string from the datetime field, it can be converted to unix timestamp before outputting the data as so: SELECT stamp = DATEDIFF(s, '19700101', some_column) FROM EVENTS WHERE some_column > 'xxx' And that solves that - w00t
  9. The answer would be: SELECT stamp = DATEDIFF(s, '19700101', column) FROM EVENTS WHERE column > 'xxx'
  10. Try putting the following at the top: $state_totals = array();
  11. <?php $a = "Hello"; <-mysql result $b= "Hello"; <-string you want to match if ($a == $b){ $a = "<font color = red>".$a."</font>"; } ?> Might not be the prettiest way of doing it, but it works.
  12. are you using the mssql.dll for your connections? There was a bug with select statements that limited return to 256 characters with that .dll - What setup do you have? If windows try using the sqlsrv.dll instead. It's got a different API which is a pain, but it apparently resolves a lot of flaws that the mssql.dll has. http://www.microsoft.com/downloads/details.aspx?FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9&displaylang=en
  13. Is it possible to select a datetime field as a unix timestamp? I was selecting the string and then converting with `strtotime` but that leaves off the seconds, so if there's a built in function that would be great -
  14. That's awesome - thanks. I'm learning slowly...
×
×
  • 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.