knowram
Members-
Posts
226 -
Joined
-
Last visited
Everything posted by knowram
-
I am not quite sure I fallow. What do I need to do to fix this problem?
-
I found a deep_in_array function on php.net which I modified to be a deep_array_search function. But for some reason it only works if the key is not 0. example function deep_array_search($value, $array, $case_insensitive = false){ foreach($array as $item){ if(is_array($item)) $ret = array_search($value, $item, $case_insensitive); else $ret = ($case_insensitive) ? strtolower($item)==$value : $item==$value; if($ret) return $ret; } return false; } $a = array('1' => array('0' => 's'), '2' => array('0' => 'p', '1' => 'r'), '3' => array('0' => 'o')); $b = array('1' => array('0' => 's'), '2' => array('1' => 'p', '2' => 'r'), '3' => array('0' => 'o')); $ret = deep_array_search('p', $a); echo ($ret); // $ret seems to be nothing $ret = deep_array_search('p', $b); echo ($ret); // $ret returns "1" like it should Any ideas why this is happening? Thanks for the help.
-
never mind i think i just found a function in the comments section of in_array on php.net
-
here is an example of the code that I am using <?php $a = array(array('s'), array('p', 'r'), array('o')); if (in_array(array('p'), $a)) { echo "'p' was found in array\n"; } ?> Is it possible to set up the in_array function so that the above if statement will return true?
-
Ok got it all figured out and yeah that is allot faster. Thanks for the help
-
Ok so this is what I have come up with foreach ($Print_Order as $key){ $resultSIIID = mssql_query(" SELECT StatisticalInterfaceIdentification.nStatisticalInterfaceIdentificationID FROM StatisticalInterfaceIdentification INNER JOIN PivotStatisticalMonitorTypeToDevice ON StatisticalInterfaceIdentification.nPivotStatisticalMonitorTypeToDeviceID = PivotStatisticalMonitorTypeToDevice.nPivotStatisticalMonitorTypeToDeviceID INNER JOIN Device ON sDisplayName = '$Device_Name[$key]' AND nDeviceTypeID = '3'") or die ("can't select StatisticalInterface"); $rowSIIID = mssql_fetch_array($resultSIIID, MSSQL_ASSOC); print_r ($rowSIIID); echo '<br>'; } But for some reason $rowSIIID is the same for each $key Any ideas?
-
I found a cool example on w3schools http://www.w3schools.com/sql/sql_join.asp but there example only deals with 2 tables I am not sure a see how to incorporate a thirded. The info I want is three tables deep.
-
An after though can you give me a syntax example. Or maybe point me in the right direction. the only place I know to search for stuff like that is php.net and it seems there is a php function join that is different. Thanks for the help
-
Thanks for the help i didn't even know about JOINs I will look into it.
-
Ok I have a series of tables that I need to sort through. meaning get one peace of info from one table to get the next peace form the next table and so on. My problem is I only know how to write the code to do it in that order. My code if (empty($_REQUEST['shInOctets_Avg']) || empty($_REQUEST['shOutOctets_Avg']) || empty($_REQUEST['shInOctets_Max']) || empty($_REQUEST['shOutOctets_Max'])){ set_time_limit(240); foreach ($Print_Order as $key){ $resultDID = mssql_query("SELECT nDeviceID FROM Device WHERE sDisplayName = '$Device_Name[$key]' AND nDeviceTypeID = '3'") or die ("can't select nDeviceID from Device"); $rowDID = mssql_fetch_array($resultDID, MSSQL_ASSOC); $resultPSM = mssql_query("SELECT nPivotStatisticalMonitorTypeToDeviceID FROM PivotStatisticalMonitorTypeToDevice WHERE nDeviceID = '$rowDID[nDeviceID]' and nStatisticalMonitorTypeID = '1'") or die ("Can't select nPivotStatisticalMonitorTypeToDeviceID"); $rowPSM = mssql_fetch_array($resultPSM, MSSQL_ASSOC) or die ("Can't find pivit number"); $Interfaces = explode("|",$Interface[$key]); foreach ($Interfaces as $Int){ if ($Int != "" && preg_match('/^(Serial)/',$Int)){ unset($IfInOctets_Max); $Int_o2 = $Int.'-802.1Q vLAN subif'; $resultSIIID = mssql_query("SELECT nStatisticalInterfaceIdentificationID FROM StatisticalInterfaceIdentification WHERE nPivotStatisticalMonitorTypeToDeviceID = '$rowPSM[nPivotStatisticalMonitorTypeTo]' and sIfDescr = '$Int'") or die ("Canb't Select nStatisticalInterfaceIdentificationID"); $rowSIIID = mssql_fetch_array($resultSIIID, MSSQL_ASSOC) or die ("Can't find SIIID"); $resultSI = mssql_query("SELECT * FROM StatisticalInterface WHERE nStatisticalInterfaceIdentificationID = '$rowSIIID[nStatisticalInterfaceIdentific]'") or die ("can't select StatisticalInterface"); $rowSI = mssql_fetch_array($resultSI, MSSQL_ASSOC); $nIfSpeedIn[$key] = $rowSI['nIfSpeedIn']; $nIfSpeedOut[$key] = $rowSI['nIfSpeedOut']; while ($rowSI = mssql_fetch_array($resultSI, MSSQL_ASSOC)){ if ((strtotime($rowSI['dPollTime']) <= strtotime("now")) && (strtotime($rowSI['dPollTime']) >= strtotime("-4 week"))){ if (empty($IfInOctets_Max)) { $IfInOctets_Max = $rowSI['nIfInOctets_Max']; }else if ($IfInOctets_Max < $rowSI['nIfInOctets_Max']) { $IfInOctets_Max = $rowSI['nIfInOctets_Max']; } if (empty($nIfOutOctets_Max[$key])) { $nIfOutOctets_Max[$key] = $rowSI['nIfOutOctets_Max']; }else if ($nIfOutOctets_Max[$key] < $rowSI['nIfOutOctets_Max']) { $nIfOutOctets_Max[$key] = $rowSI['nIfOutOctets_Max']; } } } if (empty($nIfInOctets_Max[$key])) { $nIfInOctets_Max[$key] = $IfInOctets_Max; } else { $nIfInOctets_Max[$key] = $nIfInOctets_Max[$key].'|'.$IfInOctets_Max; } } } } } My but the problem is that takes for ever given that for each interface on each device it has to go through the table of 240174 entry's (at last count) to get the info I am looking for. There has to be a better way. I would think that there should be a way to set it up so that it only has to go through that last big table once and pic out the info I need for each interface on each device. But I am not sure how to do this via code. Let me know if how I explained my problem doesn't make any sense. Any suggestions are great Thanks allot everyone.
-
Well I have two servers on is A windows box running IIS and it dose have anonymous login enabled(which I can't disable) and a Mac os x box with apache running. On the IIS box it dose not give me anything for that value. On the apache box it doesn't even show that variable. I will try it on yet another server when I get home.
-
Hmm the WScript worked but it gave me the wrong user name. example: I have a server on my network hosting this site which requires a login to associate some features with the individual that is using the site. I would like to be able to pull the user name of the person hitting the site so I can use that instead of having them go through a login page. Any ideas?? Thanks
-
Vary cool thanks
-
Is there a way to do something like this? select x from y where z "starts with" abc Thanks for the help
-
I didn't know about strtotime(). Thats cool. Thanks
-
I tried just printing the $_Server['LOGON_USER'] variable and then printing the whole $_SERVER array and nothing comes up for the LOGON_USER entry. Any idea what could be causing this.
-
So I have this database with lots of info all time stamped with this format "May 15 2007 9:44AM". What I would like to be able to specify a date range and have only entries that are in that date range be pulled from the table so that I can post the results. I know this must be possible but I have no idea host to even start. Any and all ideas would be help full Thanks allot
-
Solved never mind simpler then i though
-
I have php installed on a windows 2003 server and am trying to connect to a remote MySQL server. but I am getting this error. Warning: mysql_connect() [function.mysql-connect]: Host 'man02.associa.corp' is not allowed to connect to this MySQL server in C:\Program Files\Ipswitch\WhatsUp\HTML\NmConsole\Associainfo\test.php on line 3 Could not connect to database I know the user name and password are correct if I try to connect locally with a page on the MySQL server with localhost as the server it works fine. Any ideas? Thanks for the help
-
Is there anyway to get the username that is currently logged into a computer while visiting a page? Thanks for the help
-
Ok after some more though I don't think it is a port problem. Is there something different you have to do to connect to a sql server in a different lan? Thanks for the help
-
Any one know?? I am getting a mssql_connect(): Unable to connect to server: error and I think it is a firewall problem because it works from one server that is on the same LAN as the sql server but not from a different server on a different LAN. Or if anyone has any other ideas let me know. Thanks for the help
-
Thank worked thanks for the help
-
error when using mssql functions
knowram replied to knowram's topic in PHP Installation and Configuration
I figured out the problem thanks for taking a look -
I found what I was after thank you all for taking a look