While loop error
Hej eksperter!Jeg har en database tabel med 15.000 datoer, hvor jeg gerne vil tilfoeje navnet paa ugedagen ud for de forskellige dato entries.
Af en eller anden aarsag vil mit loop bare ikke virke. Pt faar jeg fejlen:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/livefoot/public_html/date.php on line 4
Nogen der ved hvorfor? Koden pasted nedenunder.
Paa forhaand mange tak for hjaelpen!
<?
include("connect.php");
$result = mysql_query("SELECT * FROM `match_raw`") or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
$dbdate = $row['date'];
// split the phrase by any number of commas or space characters,
// which include " ", \r, \t, \n and \f
list($day,$month, $year) = split('[/.-]', $dbdate);
$year = $year+2000;
$d_var=getdate(mktime(0,0,0,$month,$day,$year));
$result = mysql_query("UPDATE `livefoot_main`.`match_raw` SET month='$d_var[month]' WHERE date='$dbdate'") or die(mysql_error());
$result = mysql_query("UPDATE `livefoot_main`.`match_raw` SET day='$d_var[weekday]' WHERE date='$dbdate'") or die(mysql_error());
}
?>