par
Invité » 29 nov. 2005, 01:26
$tmp=mysql_query("SELECT regdate FROM ".MEMBERS."");
while($phpBB=mysql_fetch_array($tmp)) {
$date_en_format_mysql = ($phpBB['regdate']);
// Ci-dessous j'essaie de convertir ma date format mysql en format timestamp grâce à un script récupéré sur le web
function MyDateToUnixDate($date_en_format_mysql) {
$Year = substr($date_en_format_mysql,0,4);
$UnixStart=1970;
while($Year!=$UnixStart){
if(date("L", strtotime("$UnixStart"."0101"))==1)
{$NbDays=31622400;}
else {$NbDays=31536000;}
$YearInSec = $YearInSec+$NbDays;
$UnixStart++;
}
$Month = substr($date_en_format_mysql,5,2);
$MonthDiff = $Month-1;
$MonthInSec = $MonthDiff*86400*30.5;
$Day = substr($date_en_format_mysql,8,2);
$DayInSecond = $Day*86400;
$UnixTime = $YearInSec+$MonthInSec+$DayInSecond ;
return $UnixTime;
$sql = "INSERT INTO ".$table_prefix.$phpBB_table." (user_regdate) VALUES ( '$UnixTime')";mysql_query($sql) or die(mysql_error());
}
Voilà... mais lorsque j'appelle la page, elle reste blanche et n'insère pas les données dans la table mysql. Qu'est-ce qui ne va pas? Je pense que le script est juste mais c'est plutôt moi qui m'embrouille avec les fonctions...[/code]
[php]
$tmp=mysql_query("SELECT regdate FROM ".MEMBERS."");
while($phpBB=mysql_fetch_array($tmp)) {
$date_en_format_mysql = ($phpBB['regdate']);
// Ci-dessous j'essaie de convertir ma date format mysql en format timestamp grâce à un script récupéré sur le web
function MyDateToUnixDate($date_en_format_mysql) {
$Year = substr($date_en_format_mysql,0,4);
$UnixStart=1970;
while($Year!=$UnixStart){
if(date("L", strtotime("$UnixStart"."0101"))==1)
{$NbDays=31622400;}
else {$NbDays=31536000;}
$YearInSec = $YearInSec+$NbDays;
$UnixStart++;
}
$Month = substr($date_en_format_mysql,5,2);
$MonthDiff = $Month-1;
$MonthInSec = $MonthDiff*86400*30.5;
$Day = substr($date_en_format_mysql,8,2);
$DayInSecond = $Day*86400;
$UnixTime = $YearInSec+$MonthInSec+$DayInSecond ;
return $UnixTime;
$sql = "INSERT INTO ".$table_prefix.$phpBB_table." (user_regdate) VALUES ( '$UnixTime')";mysql_query($sql) or die(mysql_error());
}
[/php]
Voilà... mais lorsque j'appelle la page, elle reste blanche et n'insère pas les données dans la table mysql. Qu'est-ce qui ne va pas? Je pense que le script est juste mais c'est plutôt moi qui m'embrouille avec les fonctions...[/code]