Jump to content

sandy1028

Members
  • Posts

    387
  • Joined

  • Last visited

Everything posted by sandy1028

  1. Hi, Two arrays array_1=array(A,B,C); arry_2=array(A,A,B,B,A,B,A,B); How to find out the element which is not in arry_2. Here in the above example the element should show as C.
  2. Hi, In the code below when status changes from 0 to 1 the difference is calculated. When status is 0 the difference of timestamp is not calculated. Please tell me how to do it. i.e, In one row I want the difference like $tdiff = 2008-06-13 00:30:00-2008-06-13 00:10:00 <?php $values=array( "0#2008-06-13 00:10:00#master", "0#2008-06-13 00:20:00#master", "0#2008-06-13 00:30:00#master", "1#2008-06-13 00:40:00#stud", "0#2008-06-13 00:50:00#stud", "1#2008-06-13 01:10:00#stud" ); $i=0; $outset = array(); $status = array(); $aset = 0; foreach($values as $v) //For each element in the values array { // Split the value by hash $vals = explode('#', $v); // If this is the first loop, set the previous status if($i == 0) {$previous_value = $vals[0]; $i=1; $starttime = $vals[1];} // If the previous =0 and the current is 1, store the values in a new array for output if($previous_value == 0 && $vals[0] == 1) { $aset = 1; $tdiff = date('h:i:s', strtotime($vals[1]) - strtotime($starttime)); $outset[] = $starttime.' '.$vals[1].' '.$tdiff.' '.$vals[2]; } if($vals[0] == 0 && $previous_value == 1) { $starttime = $vals[1]; } // Store the current, for the next loop it is previous value $previous_value = $vals[0]; $lasttime = $vals[1]; } if($aset == 0) { $tdiff = strtotime($vals[1])-strtotime($starttime); $outset[] = $starttime.' '.$lasttime.' '.$tdiff.' '.$vals[2]; } echo"<pre>"; print_r($outset); echo"</pre>";
  3. 0 | 2008-06-10 15:30:01 | A 1 | 2008-06-10 15:40:01 | A // Calcute timestamp as 10 min 1 | 2008-06-10 15:50:01 |A //Skip 1 | 2008-06-10 16:00:01 |A //Skip 1 | 2008-06-10 16:10:01 |A //Skip 0 | 2008-06-10 16:20:01 |A // Calcute timestamp as 10 min 1 | 2008-06-10 16:30:01 |A 1 | 2008-06-10 16:40:01 |A //Skip 1 | 2008-06-10 16:50:01 |A //Skip 1 | 2008-06-10 17:00:01 |A //Skip 0 | 2008-06-10 17:10:01 |A 1 | 2008-06-10 17:20:01 |A //Calcute difference as 10 min 1 | 2008-06-10 17:30:01 |A 0 | 2008-06-10 17:40:01 |A 0 | 2008-06-10 17:50:01 |A //Clauculate as 20 min and how to push into array as it shows like this in the table The fields are Status, imestamp and Name. As in the above example It should display as In the table the Name| Start Time | End Time | Difference A | 2008-06-10 15:30:01 |2008-06-10 15:40:01 | 10 A | 2008-06-10 16:10:01 | 2008-06-10 16:20:01 | 10 Based on the status 0 timestamp difference has to be calculated. Please help me.
  4. Hi, $date1='2008-05-21'; $date2='2008-05-31'; How to find the dates between two dates using mktime() and push into an array
  5. Name Start time End time A 2008-06-01 07:00:01 2008-06-01 07:10:01 0:0:10 A 2008-06-01 07:10:01 2008-06-01 09:50:01 0:0:10 A 2008-06-01 09:50:01 2008-06-01 10:00:01 0:0:10 B 2008-06-01 09:50:01 2008-06-01 10:00:01 0:0:10 B 2008-06-01 09:50:01 2008-06-01 10:00:01 0:0:10 Actually in the table it is displayed as the previous time is taken as the next Start time for the next row for the same name. How to aviod it. The code used is as below: while($result = mysql_fetch_array($row)) { $currentStatus = $result['status']; $currentTime = $result['timestamp']; $previousStatus = $previousStatus == '' ? $currentStatus : $previousStatus; $previoustime = $previoustime == '' ? $currentTime : $previoustime; //State change. if($previousStatus == $currentStatus) { $previousStatus=$currentStatus; continue; } $d = strtotime($currentTime) - strtotime($previoustime); array_push($records,"$result[2]#$ip[0]#$result[2]#$previoustime#$result[1]#$d#$_"); $previousStatus = $currentStatus; $previoustime=$currentTime; Actually in the above code the records are pushed into the array even if state change from 1 to 0. But I need only data from 0 to 1. How can I display it. How to push records into the array if status is always 0. If status doesnot change to 1 then 1st timestamp and last timestamp difference should be calculated. How to do it
  6. Hi, How to check which framework is used in the php version PHP 5.2.3 (cli) (built: Jun 9 2007 01:41:33) Copyright © 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright © 1998-2007 Zend Technologies how to Decode the following encryption 'WW91IGhhdmUgc3VjY2Vzc2Z1bGwgZGVjb2RlZCB0aGUgQmFzZTY0IGVjb2Rpbmc= ' and what type of encryption is it and how to decode it.
  7. HI, How to return the previous date from the function function previousdate(){ date1=array(); $previous = mktime(0,0,0,date("m"),date("d")-1,date("Y")); $date1[]= date('Y-m-d', $previous); return $date1; } Here I am getting error as cannot use date.
  8. Anyone please tell me what type of a slider is used here and can I develop this using Ext JS
  9. Hello, Can you please tell me how such scrolling and zooming for the graphs are given. http://support.dundas.com/OnlineDocumentation/WebChart2005/ScrollingAndZooming.html
  10. Hi, Please help me how to data in the table of last 6 months. Example, from Octoberl 1 2007 to March 2008. Excluding the current month.
  11. select com.*,exc.exec from completedtable com, exectable where com.jobid=exc.jobid group by exc.exec; This query doesnot work in mysql database. It doesnot execute even after ten mnutes
  12. Please help me $result = mysql_query("select jobid,unix_timestamp(subtime)) from `completedtable`"); $no_of_rows = mysql_num_rows($result); while($r = mysql_fetch_array($result)){ $exec = ''; $res = mysql_query("select distinct(exec) from `exectable` where jobid='".$r[0]."'"); //$res=mysql_query($res1); while($row = mysql_fetch_array($res)){ $exec .= $row[0]."\n"; } The field exec has more than 3 rows so I have used it in while loop. Which takes lots of time to query. How can I make a query faster. Two tables has jobid has common field name.
  13. Can anyone tell me how this page is implemented. How to pass the values to table as well as to plot the graph in php. http://pheezer.uits.iupui.edu/tp2traffic/
  14. I have to 3 tables Table1,table2,table3 and in all tables field name `fieldname` is similar . I have to select values from table1 the values which is not in table2 and table3. Select distinct(fieldname) from table1 where fieldname not in (select distinct(fieldname) from table2 union (select distinct(fieldname) from table3) But I am gtting the proper result
  15. How to disable the value 4 andvalue 5 from second listbox when only C is selected from the 1st list box. Now second list is disabled. I have to enable the list box but only values of 2nd list box should be disabled when C is selected. <html> <head> <script type="text/javascript"> function checkSelect1(selVal) { alert(selVal); sel2 = document.getElementById("select2"); if (selVal=="C" || selVal=="value5") { sel2.disabled = false; } else { sel2.disabled = true; } } </script> </head> <body> <select name="select1" onchange="checkSelect1(this.value);"> <option value="R">1</option> <option value="Q">2</option> <option value="S">3</option> <option value="C">4</option> <option value="--">5</option> </select> <select name="select2" disabled> <option value="value1">1</option> <option value="value2">2</option> <option value="value3">3</option> <option value="value4">4</option> <option value="value5">5</option> </select> </body> </html>
  16. Hi, I have the code below and I have the output in reverse order but if I use array_reverse($time_interval) it is not working Please help me list($year,$day,$month,$hour,$minute,$second) = explode(':', date('Y:m:d:H:i:s')); $minute = 60*(floor($minute/60)); $time_interval = array(); for($minutes=0; $minutes<=24*60; $minutes += 60) { $ti = date('H:i', mktime($hour,$minute-$minutes,$second,$month,$day,$year)); //array_reverse($time_interval); array_push($time_interval,$ti); //array_reverse($time_interval); } array_pop($time_interval); for($i=0;$i<count($time_interval);$i++){ print $time_interval[$i]."\n"; }
  17. Function clusteravail queries the mysql and returns the data. When I remove the header("...................') the output works fine. But when I include header to open in word it doesnot get updated.
  18. Can you send me good links. I just want the output of the php where the table and data in it should get refreshed. BUt the code which I tried will open in word format and doesnot get refreshed
  19. How to remove the optgroup and enable the fields when option value Completed is selected. <select name='jobstatus'> <option value="--">-- <option value="R">Running <option value="C">Completed <option value="S">Suspended <option value="Q">Queued </select> <select name="cluster" onChange="if(this.options[this.selectedIndex].state=='disabled') this.selectedIndex=0"> <option value="--" selected>-- <? $clusters = clusterNames(); //array_shift($clusters); foreach($clusters as $c){ echo "<option value=\"$c\">$c</option>"; } echo "<optgroup label=\"Clusters down\">"; //echo "<optgroup label=\"Clusters down\">"; $clustersdown=disabledCluster(); foreach($clustersdown as $d){ echo "<option value=\"\" state=\"disabled\" style=\"color:#FF0000;\"><font color=\"#FF0000\">$d</font></option>"; } echo "</optgroup></select>";
  20. I have to open a php page output in the word file and which it should be refreshed everytime. Can you suggest me how can I proceed with it
  21. Please anyone tell me why the word document doesnot get updated when opened in word format
  22. From the database and which is updated for 2 minutes. But the word file is not changed
  23. The word document is not getting refreshed. It has to get refreshed when the value retrived from the database. But it is not happening. The page open the word document which was opened at the first time
  24. How to write the php script to open in a word format. I tried the code below which opens in word documetn but the contents are not dynamic. The word page is not getting refreshed $rec=clusteravail(); array_shift($rec); header("Content-type: application/msword"); echo "<html><head><title>REPORT</title><meta http-equiv=\"refresh\" content=\"100\"></head><body bgcolor=\"#FFFFFF\" text=\"#000000\"><TABLE BORDER=2 CELLPADDING=4 width=\"100%\"><TR><TH COLSPAN=8>DATE AS ON 2008-02-27</TH></TR><TR><TH COLSPAN=8>Head and CLIENT NODE Status of Garuda Network</TH></TR><TR><TD>SL NO</TD><TD>CLIENT NODE NAME</TD><TD>IP ADDRESS</TD><TD>HEAD NODE NAME</TD><TD>START TIME</TD><TD>END TIME</TD><TD>DURATION</TD></TR>"; for($i=0;$i<=count($rec);$i++){ $data=split("#",$rec[$i]); echo "<tr>"; echo "<td>$i</td>"; echo "<td>$data[0]</td>"; echo "<td>$data[1]</td>"; echo "<td>$data[2]</td>"; echo "<td>$data[3]</td>"; echo "<td>$data[4]</td>"; echo "<td>$data[5]</td>"; } echo "</tr></table></body></html>";
  25. I want the maketime but the values in database and system time soesnot match how to avoid it
×
×
  • 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.