here is a small page from which to enter data into my database and I can't get it to work.
Can anyone help to solve it.
Best
F
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
require("./resources/globals.php");
//This is a PHP (4/5) script example on how eurofxref-daily.xml can be parsed
//Read eurofxref-daily.xml file in memory
$XMLContent= file("
http://www.ecb.europa.eu/stats/eurof...xref-daily.xml");
//the file is updated daily between 14:15 and 15:00 CET
foreach ($XMLContent as $line) {
if (ereg("currency='([[:alpha:]]+)'",$line,$currencyCode)) {
if (ereg("rate='([[:graph:]]+)'",$line,$rate)) {
//Output the value of 1 EUR for a currency code
//echo '1 € = '.$rate[1].' '.$currencyCode[1].'<br />';
$rate= ''.$rate[1].'<br />';
$currencyCode=''.$currencyCode[1].'<br />';
$updateStmt = "Update currency SET rate=$rate WHERE code = $currencyCode ";
// Connect to the Database
if (!($link=mysql_pconnect($location,$userName,$passw ord))) {
DisplayErrMsg(sprintf("error connecting to host %s, by user %s",
$location, $userName)) ;
//exit() ;
}
// Select the Database
if (!mysql_select_db($dbname, $link)) {
DisplayErrMsg(sprintf("Error in selecting %s database", $dbname)) ;
DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link))) ;
//exit() ;
}
// Execute the Statement
if (!mysql_query ($updateStmt)){
// Execute the Statement
//if (!mysql_query($updateStmt, $link)) {
DisplayErrMsg(sprintf("Error in executing %s stmt", $updateStmt)) ;
DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link))) ;
// exit() ;
}
///////////////////////////////////////////
}
}
}
?>
<body>
</body>
</html>