|
|
|
|
![]() ![]() |
Nov 21 2006, 07:42 AM
Post
#1
|
|
|
Super Member Group: [HOSTED] Posts: 500 Joined: 5-November 06 Member No.: 17,016 myCENTs:NEGATIVE[-20.12] |
Hi,
A few question here, 1. Just wondering, the MySQL hosted on astahost.com is actually version "4.0.26-Max" according to phpmyadmin. But why is cPanel showing "4.1.21-standard"? 2. Actually i've existing codes that need function introduced after version 4.1.1, is there by any chance astahost or xisto is going to upgrade the MySQL package? Thanks |
|
|
|
Nov 22 2006, 03:42 AM
Post
#2
|
|
|
Super Member Group: [HOSTED] Posts: 805 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 myCENTs:46.87 |
Hi, A few question here, 1. Just wondering, the MySQL hosted on astahost.com is actually version "4.0.26-Max" according to phpmyadmin. But why is cPanel showing "4.1.21-standard"? 2. Actually i've existing codes that need function introduced after version 4.1.1, is there by any chance astahost or xisto is going to upgrade the MySQL package? Thanks Hi, In my case cPanel shows that i have MySql version 4.0.27-standard but according to phpMyAdmin i have 4.0.26-Max, its very strange, may be an admin can tell us why exists this differences. Best regards, |
|
|
|
Nov 22 2006, 04:21 AM
Post
#3
|
|
|
Super Member Group: [HOSTED] Posts: 500 Joined: 5-November 06 Member No.: 17,016 myCENTs:NEGATIVE[-20.12] |
Hi,
I have another question. My web page needs to use a few mysql function that's introduce after v4.1.1, since our hosting only provide v4.0.26, just wondering is there any alternative function for : 1. DATEDIFF 2. TIMEDIFF 3. ADDTIME 4. SUBTIME Most important is actually TIMEDIFF. I've googled and no result. Really sad, never thought that i'll actually use a function that's not available in common hosting server |
|
|
|
Nov 22 2006, 04:29 AM
Post
#4
|
|
|
Member [ Level 2 ] Group: Members Posts: 63 Joined: 28-August 06 Member No.: 15,585 |
Hi, I have another question. My web page needs to use a few mysql function that's introduce after v4.1.1, since our hosting only provide v4.0.26, just wondering is there any alternative function for : 1. DATEDIFF 2. TIMEDIFF 3. ADDTIME 4. SUBTIME Most important is actually TIMEDIFF. I've googled and no result. Really sad, never thought that i'll actually use a function that's not available in common hosting server Those don;t sound like functions but board names. If google can't help you, and they've cached all of the mysql handbook then there minor, changable things. Decipher the php (i assume) your using and just figure out how they work. If all else fails, follow original instructions completly. |
|
|
|
Nov 22 2006, 04:48 AM
Post
#5
|
|
|
Super Member Group: [HOSTED] Posts: 500 Joined: 5-November 06 Member No.: 17,016 myCENTs:NEGATIVE[-20.12] |
Those don;t sound like functions but board names. If google can't help you, and they've cached all of the mysql handbook then there minor, changable things. Decipher the php (i assume) your using and just figure out how they work. If all else fails, follow original instructions completly. Those are MySQL's functions. I wrote the web software myself. It was working on my machine and on hosting server that provides MySQL version higher than 4.1.1. As also mentioned in MySQL reference manual, those function are only introduce after 4.1.1 |
|
|
|
Nov 22 2006, 08:21 PM
Post
#6
|
|
|
Super Member Group: [HOSTED] Posts: 805 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 myCENTs:46.87 |
Those are MySQL's functions. I wrote the web software myself. It was working on my machine and on hosting server that provides MySQL version higher than 4.1.1. As also mentioned in MySQL reference manual, those function are only introduce after 4.1.1 Well, a few months ago i need the same functions exactly for the same reasons as you and lucky me i found this php code but i dont remember where i found it CODE <?php function datediff($interval, $datefrom, $dateto, $using_timestamps = false) { /* $interval can be: yyyy - Number of full years q - Number of full quarters m - Number of full months y - Difference between day numbers (eg 1st Jan 2004 is "1", the first day. 2nd Feb 2003 is "33". The datediff is "-32".) d - Number of full days w - Number of full weekdays ww - Number of full weeks h - Number of full hours n - Number of full minutes s - Number of full seconds (default) */ if (!$using_timestamps) { $datefrom = strtotime($datefrom, 0); $dateto = strtotime($dateto, 0); } $difference = $dateto - $datefrom; // Difference in seconds switch($interval) { case 'yyyy': // Number of full years $years_difference = floor($difference / 31536000); if (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom), date("j", $datefrom), date("Y", $datefrom)+$years_difference) > $dateto) { $years_difference--; } if (mktime(date("H", $dateto), date("i", $dateto), date("s", $dateto), date("n", $dateto), date("j", $dateto), date("Y", $dateto)-($years_difference+1)) > $datefrom) { $years_difference++; } $datediff = $years_difference; break; case "q": // Number of full quarters $quarters_difference = floor($difference / 8035200); while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom)+($quarters_difference*3), date("j", $dateto), date("Y", $datefrom)) < $dateto) { $months_difference++; } $quarters_difference--; $datediff = $quarters_difference; break; case "m": // Number of full months $months_difference = floor($difference / 2678400); while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom)+($months_difference), date("j", $dateto), date("Y", $datefrom)) < $dateto) { $months_difference++; } $months_difference--; $datediff = $months_difference; break; case 'y': // Difference between day numbers $datediff = date("z", $dateto) - date("z", $datefrom); break; case "d": // Number of full days $datediff = floor($difference / 86400); break; case "w": // Number of full weekdays $days_difference = floor($difference / 86400); $weeks_difference = floor($days_difference / 7); // Complete weeks $first_day = date("w", $datefrom); $days_remainder = floor($days_difference % 7); $odd_days = $first_day + $days_remainder; // Do we have a Saturday or Sunday in the remainder? if ($odd_days > 7) { // Sunday $days_remainder--; } if ($odd_days > 6) { // Saturday $days_remainder--; } $datediff = ($weeks_difference * 5) + $days_remainder; break; case "ww": // Number of full weeks $datediff = floor($difference / 604800); break; case "h": // Number of full hours $datediff = floor($difference / 3600); break; case "n": // Number of full minutes $datediff = floor($difference / 60); break; default: // Number of full seconds (default) $datediff = $difference; break; } return $datediff; } //echo datediff('d','9/7/2006','12/7/2006') //this will return the interval of day between the 2 days ?> Best regards, |
|
|
|
Nov 23 2006, 05:02 AM
Post
#7
|
|
|
Super Member Group: [HOSTED] Posts: 500 Joined: 5-November 06 Member No.: 17,016 myCENTs:NEGATIVE[-20.12] |
Thanks, that sure helps.
Actually I was also looking for a way to do it in mysql itself, cause my query involve some recursive calculation on date/time. If it were to read the result then process by php, performance will be greatly reduce. Well, if there's no alternative, then that might have to be the only way out. Thanks again |
|
|
|
Nov 24 2006, 05:25 AM
Post
#8
|
|
|
Member [ Level 2 ] Group: Members Posts: 53 Joined: 11-November 06 Member No.: 17,170 |
according to my script
MySQL Version:4.0.26-Max MySQL client Version:4.1.21 my script chackes server details (homepage -> Server Details) based on MySQL conection to a user NoMore |
|
|
|
Nov 24 2006, 03:14 PM
Post
#9
|
|
|
Premium Member Group: Members Posts: 238 Joined: 9-September 05 Member No.: 8,400 |
Why don't we put up a request to the admin that to upgrade to MySQL 5?
Is there any way by which backward compatibility be maintained? |
|
|
|
Nov 25 2006, 06:20 AM
Post
#10
|
|
|
Super Member Group: [HOSTED] Posts: 805 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 myCENTs:46.87 |
Thanks, that sure helps. Actually I was also looking for a way to do it in mysql itself, cause my query involve some recursive calculation on date/time. If it were to read the result then process by php, performance will be greatly reduce. Well, if there's no alternative, then that might have to be the only way out. Thanks again You are welcome, and if you want a way to do it in mysql well you can check the store procedures and functions -it works since version 5.0- or you can create your own functions using the UDF interface or also you can add functions as native (built in) mysql functions, this what i found at the mysql manual: QUOTE
Best regards, |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 4th December 2008 - 01:53 AM |