Jump to content
xisto Community
faulty.lee

What Is The MySQL Version @ Asta ? MySQL 4.0.26-Max<br />

Recommended Posts

Hi,A few question here,1. Just wondering, the MySQL hosted on Xisto.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 Xisto or xisto is going to upgrade the MySQL package?Thanks

Share this post


Link to post
Share on other sites

Hi,
A few question here,

1. Just wondering, the MySQL hosted on Xisto.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 Xisto 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,

Share this post


Link to post
Share on other sites

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. DATEDIFF2. TIMEDIFF3. ADDTIME4. SUBTIMEMost 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 :P

Share this post


Link to post
Share on other sites

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 :P

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 :P so i hope it helps you.

<?phpfunction 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,

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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:

You can add functions through the user-defined function (UDF) interface. User-defined functions are compiled as object files and then added to and removed from the server dynamically using the CREATE FUNCTION and DROP FUNCTION statements. See Section 24.2.2, “CREATE FUNCTION Syntax”.

You can add functions as native (built-in) MySQL functions. Native functions are compiled into the mysqld server and become available on a permanent basis

Best regards,

Share this post


Link to post
Share on other sites

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?


MySQL 5 is still fairly quite new, so the chances of havin' it soon is a lil' small until MySQL 5 has been fully tested.

xboxrulz

Share this post


Link to post
Share on other sites

MySQL 5 is still fairly quite new, so the chances of havin' it soon is a lil' small until MySQL 5 has been fully tested.
xboxrulz


What about the last stable version of 4.x? A lot of new function is introduced since 4.0.26, the version used by Xisto.

Share this post


Link to post
Share on other sites

Hi,

I've found the way to do what i wanted in the first place.

TIMEDIFF(t1, t2) can be replace with

SEC_TO_TIME(TIME_TO_SEC(t2) - TIME_TO_SEC(t1))
simple as that. Never thought of it that way

Found that in O'Reilly: MySQL Cookbook. The O'Reilly's series is really good, very thoughtful and well suited problem/solution type of book for programmers.

Just have to replace all occurrences of TIMEDIFF with the above. At least that solved part of my problem, now my code can run on MySQL older that 4.1.1. Will have to remember to stick to the lowest possible denominator all time, for portability.

Hooray!!!!!

Share this post


Link to post
Share on other sites

Hi,
I've found the way to do what i wanted in the first place.

TIMEDIFF(t1, t2) can be replace with

SEC_TO_TIME(TIME_TO_SEC(t2) - TIME_TO_SEC(t1))
simple as that. Never thought of it that way

Found that in O'Reilly: MySQL Cookbook. The O'Reilly's series is really good, very thoughtful and well suited problem/solution type of book for programmers.

Just have to replace all occurrences of TIMEDIFF with the above. At least that solved part of my problem, now my code can run on MySQL older that 4.1.1. Will have to remember to stick to the lowest possible denominator all time, for portability.

Hooray!!!!!
Well first time i listen about this 2 mysql functions, that's because when i found a solution for something only sometimes i continue searching another solution :P

And about the O'Reilly's Cookbook series i agree with you, there are really good, right now i'm reading the PHP Cookbook but i'm not sure which PHP version was used, i guess 4.x, could someone share an updated version of this book????

Best regards,

Share this post


Link to post
Share on other sites

Well first time i listen about this 2 mysql functions, that's because when i found a solution for something only sometimes i continue searching another solution :P
And about the O'Reilly's Cookbook series i agree with you, there are really good, right now i'm reading the PHP Cookbook but i'm not sure which PHP version was used, i guess 4.x, could someone share an updated version of this book????

Best regards,

That 2 function TIME_TO_SEC/SEC_TO_TIME is actually very useful for calculating interval. Divide by 60, then you get minute and so on. Really flexible, can get into anything you want to do with date/time

I have both the 1st and 2nd edition of the Php Cookbook. The 1st targeting 3.x and 4.x while the 2nd targeting 5.x. Am i allowed to upload pirated/illegal item in this forum? I don't mind to upload. If i'm not allowed to, then i can email to you

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.