Я всегда запускаю с Время Joda . Работа с датами и временем в Java всегда является "забавным" но Временем Joda, снимает деформацию.
у Них есть классы Интервала и Продолжительности, которые делают половину того, что Вы ищете. Не уверенный, если у них есть функция для вывода в читаемом формате все же. Я буду продолжать смотреть.
HTH
Calling mysql_fetch_assoc()
retrieves the next row (i.e., the next one you haven't already retrieved). Once you've retrieved all the rows, it returns false
. So, once you've gotten through that first loop, you have retrieved all the rows, and all you'll get back is false
every time!
If you need to reuse the same data twice, how about putting it all in an array?
$rows = array();
while($row = mysql_fetch_assoc($affiliateID)){
$rows[] = $row;
}
Now you can iterate through $rows
as many times as you like:
foreach($rows as $row) { ... }
This doesn't work because once you run through the result set once, the results internal pointer is at the end. To use it again you need to use mysql_data_seek before your second loop to reset the internal pointer to the beginning of the result set.
Вы можете искать первую строку ... используя mysql_data_seek ($ affiliateID, 0), теперь вы можете снова выполнить mysql_fetch_assoc () ... в любом случае, я предпочитаю загружать результат в массив .