ricbax
Members-
Posts
14 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Male
-
Location
Canada
ricbax's Achievements
Newbie (1/5)
0
Reputation
-
I have seen many calendars that use the date function. Does anyone have a function that would allow for the following output. It would be mon - fri weekends excluded. Mar 2-6 Mar 9-13 Mar 16-20 Mar 23-27 Mar 30 - Apr 3 Apr 6 - 10 and so on...
-
I am working with the follow 2 arrays based of some manipulation from a XML document. //statuses an item has been in. Array ( [0] => New [1] => Work in Progress [2] => Waiting customer reply [3] => Updated [4] => Work in Progress [5] => Updated [6] => Work in Progress [7] => Waiting customer reply [8] => Closed ) // time in hours Array ( [0] => 0.08 [1] => 138.75 [2] => 25.5 [3] => 45.72 [4] => 8.13 [5] => 0.27 [6] => 2.01 [7] => 19.12 [8] => 215.38 ) How can I get the total amount of hours based on statuses. This is an example, statues will vary per item. New = 0.08, Work in Progress = 148.89 (total of keys 1,4,6), etc.
-
I forgot to mention that the scan.php would be located on http://server1.domain.com/scan.php
-
Is it possible to scan multiple directories/subdirectories to locate files with php even if they are not on the same server? So for example, I have 50+ flat text files all with the name "phone.txt" but they are scattered across a labyrinth of directories. http://server6.domain.com/clients/data/March_26_2004_1000_PM/Company1/phones.txt http://server6.domain.com/clients/data/August_6_2005_800_PM/New/Company56/phones.txt I need a way to locate and consolidate all these numbers fast, is it possible?
-
:D After plugging away at this for hours I finally came to a [b]rough [/b] solution. I feel that it really isn't a part of the Pager class, and would appreciate if someone could tell me how I could clean this up and make it a bit more cohesive with the class. Some discussion on this would be great before marking it * SOLVED *. However if I figure something out before the experts on here I will be sure to post my findings as I did here already. My solution: [code=PHP SOLUTION] <?php // get the pager input values $page = $_GET['page']; $limit = 15; if(empty($start))$start=0; $result = mysql_query("select count(*) from my_db where mix_id='".$_GET['id']."'"); $total = mysql_result($result, 0, 0); $per_page = 15; // Number of items to show per page (MUST MATCH $limit, so if $limit = 1, $per_page = 1) $showeachside = 20; // Number of items to show either side of selected page $cur = ceil($start / $per_page)+1; // Current page number $thispage = $PHP_SELF; // work out the pager values $pager = Pager::getPagerData($total, $limit, $page); $offset = $pager->offset; $limit = $pager->limit; $page = $pager->page; ?> <?php $pg=1; if(($start-$per_page) >= 0) { $next = $start-$per_page; ?> <a href="<?php print("$thispage".($next>0?("?id=".$_GET['id']."&div=open&page=".($cur - 1)."&start=").$next:"?id=".$_GET['id']."&div=open&page=".($cur - 1)."&start="));?>">«</a> <?php } ?><?php $eitherside = ($showeachside * $per_page); for($y=0;$y<$total;$y+=$per_page) { $class=($y==$start)?"pageselected":""; if(($y > ($start - $eitherside)) && ($y < ($start + $eitherside))) { ?> <a class="<?php print($class);?>" href="<?php print("$thispage".($y>0?("?id=".$_GET['id']."&div=open&page=".($pg)."&start=").$y:"?id=".$_GET['id']."&div=open&page=".($pg)."&start="));?>"><?php print($pg);?></a> <?php } $pg++; } ?><?php if($start+$per_page<$total) { ?> <a href="<?php print("$thispage?id=".$_GET['id']."&div=open&page=".($cur + 1)."&start=".max(0,$start+$per_page));?>">»</a></span> <?php } ?> [/code]
-
Does anyone know how I can modify the code below to go from [color=blue][u]<<[/u] [u]1[/u] [u]2[/u] [u]3[/u] [u]4[/u] [b]5[/b] [u]6[/u] [u]7[/u] [u]8[/u] [u]9[/u] [u]10[/u] [u]11[/u] [u]12[/u] [u]13[/u] [u]14[/u] [u]15[/u] [u]>>[/u][/color] to something more reduced [color=blue][u]<<[/u] [u]3[/u] [u]4[/u] [b]5[/b] [u]6[/u] [u]7[/u] [u]8[/u] [u]9[/u] [u]10[/u] [u]11[/u] [u]12[/u] [u]>>[/u][/color] [code] <?php class Pager { function getPagerData($numHits, $limit, $page) { $numHits = (int) $numHits; $limit = max((int) $limit, 1); $page = (int) $page; $numPages = ceil($numHits / $limit); $page = max($page, 1); $page = min($page, $numPages); $offset = ($page - 1) * $limit; $ret = new stdClass; $ret->offset = $offset; $ret->limit = $limit; $ret->numPages = $numPages; $ret->page = $page; return $ret; } } ?> [/code] [code] <?php // get the pager input values $page = $_GET['page']; $limit = 15; $pgresult = mysql_query("select count(*) from my_db"); $total = mysql_result($pgresult, 0, 0); // work out the pager values $pager = Pager::getPagerData($total, $limit, $page); $offset = $pager->offset; $limit = $pager->limit; $page = $pager->page; echo "<span style='font-size: 10px;'>Result Pages: "; // output paging system (could also do it before we output the page content) if ($page == 1) // this is the first page - there is no previous page echo ""; else // not the first page, link to the previous page echo "<a href=\"results.php&page=" . ($page - 1) . "\">"." « "."</a>"; for ($i = 1; $i <= $pager->numPages; $i++) { echo ""; if ($i == $pager->page) echo "<span>$i</span>"; else echo "<a href=\"results.php?&page=$i\">$i</a>"; echo " | "; } if ($page == $pager->numPages) // this is the last page - there is no next page echo "" ; else // not the last page, link to the next page echo "<a href=\"results.php?&page=" . ($page + 1) . "\">"." » "."</a></span>"; ?> [/code]
-
php + capture download from right-click Save Link As *SOLVED*
ricbax replied to ricbax's topic in PHP Coding Help
Sometimes it is right in front of your eyes ... :o Thanks ... works a treat! -
php + capture download from right-click Save Link As *SOLVED*
ricbax replied to ricbax's topic in PHP Coding Help
Any suggestions on the wrapper ??? -
Here is the situation: I want to capture when a file gets downloaded, basically a counter that sends the value to my db. The problem: Due to plugins and browser issues I have disabled the the ability to download with a left-click (which rules out $_GET), forcing a right-click and the user choosing the Save Link As option from the pop-up menu. So my question is how can I capture the right-click and progress a counter? TIA ricbax
-
Is there an alternative to this function for MySQL 4.0 I realized that the GROUP_CONCAT () only works on MySQL 4.1 and above.
-
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]mysql> [span style=\'color:blue;font-weight:bold\']select[/span] * from repairs; +----+---------------------------------+------------------------------------------+ | id | cat_1 | cat_2 | +----+---------------------------------+------------------------------------------+ | 1 | Renovation, Regular Maintenance | Air Conditioning Contractors and Systems | | 2 | Repair | Air Conditioning Equipment-Repair | | 3 | Regular Maintenance | Air Conditioning Systems-Cleaning | +----+---------------------------------+------------------------------------------+ 3 rows in set (0.00 sec) mysql> [span style=\'color:blue;font-weight:bold\']INSERT[/span] INTO dynamic1 (cat_1, cat_2) VALUES (([span style=\'color:blue;font-weight:bold\']SELECT[/span] GROUP_CONCAT(cat_1) FROM repairs WHERE cat_2 IN ('Air Conditioning Contractors [span style=\'color:blue\']and Systems'[/span], 'Air Conditioning Equipment[span style=\'color:orange\']-Repair'[/span], 'Air Conditioning Systems[span style=\'color:orange\']-Cleaning'[/span])), 'Air Conditioning Contractors [span style=\'color:blue\']and Systems, Air Conditioning Equipment-Repair, Air Conditioning Systems-Cleaning'[/span]); Query OK, 1 row affected (0.00 sec) mysql> [span style=\'color:blue;font-weight:bold\']select[/span] * from dynamic1; +----+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------+ | id | cat_1 | cat_2 | +----+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------+ | 4 | Renovation, Regular Maintenance,Repair,Regular Maintenance | Air Conditioning Contractors and Systems, Air Conditioning Equipment-Repair, Air Conditioning Systems-Cleaning | +----+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) [!--sql2--][/div][!--sql3--] #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT GROUP_CONCAT(cat_1) FROM repairs WHERE cat_2 IN ('Air Co I keep getting this error. I did get this query to work once but I forget what I did to get it to work ... please help.
-
Is there anyway to recover a dropped database on a windows system? recover MYD and MYI files?
-
mysql_query() to the rescue
-
I have values being selected from another table in the database and a formula applied to it, then have a UPDATE query to a different table and SET those values in the correct fields but it does not execute. why? I tested the statement in the mysql commandline and it worked and it phpmyadmin as well. Is the table being locked from the previous SELECT statement?