help need with error
Posted: Mon Jun 27, 2011 8:28 am
this is my code,
<?php
include('Wizard.php');
class FieldMap extends Wizard{
public function getPageTitle(){
return "Map DB Fields";
}
public function index(){
$this->fieldMapping();
}
public function deleteMapping(){
if(is_file(PATH_DIR."dbMaps/".$_GET[dbID].".php")){
@unlink(PATH_DIR."dbMaps/".$_GET[dbID].".php");
}
$this->myDBObj->delete("databases" , "id = '$_GET[dbID]'");
echo $this->myDBObj->getLastError();
$this->myDBObj->delete("sites" , "dbid = '$_GET[dbID]'");
header("Location: .");
}
public function fieldMapping(){
if(count($_POST)){
$this->saveMap();
}
$fieldsData = array();
if(is_file(PATH_DIR."dbMaps/".$_GET[dbID].".php")){
include(PATH_DIR."dbMaps/".$_GET[dbID].".php");
}
$tableFields = array();
{
$tables = $this->dbObj->getTables();
foreach($tables as $table){
$tableFields[$table] = $this->dbObj->getFields($table);
}
$data[tableFields] = $tableFields;
$data[PKs] = $this->dbObj->getPKs();
$data[fieldsData] = $fieldsData;
$this->loadTemplate("FieldMap" , $data);
}
function saveMap(){
$tables = $this->dbObj->getTables();
foreach($tables as $table){
$fields = $this->dbObj->getFields($table);
foreach($fields as $field){
$_DATA['data']['tables'][$table]['fields'][] = $field;
$fldName = $table."_".$field[Field];
if($field["PK"]=="PRI"){
$_DATA['data']['tables'][$table]['primary'] = $field[Field];
}
if($_POST["fk_$fldName"] != ""){
$_DATA['data']['tables'][$table]['links'][$field[Field]] = $_POST["fk_$fldName"];
}
{
$fileContent = var_export($_DATA['data'] , true);
$fileContent = "<?\n\$fieldsData = $fileContent ; \n?>";
$fp = fopen(PATH_DIR."dbMaps/".$_GET[dbID].".php" , "w");
fwrite($fp , $fileContent);
fclose($fp);
header("Location: .");$this->funcPath("MainPage");
}
?>
this is my error message
Parse error: syntax error, unexpected $end in /home/j05ayrw/public_html/viz/Classes/Wizards/FieldMap.php on line 77
i got something wrong and thisd is driving me nuts. any suggestions most welcome!
<?php
include('Wizard.php');
class FieldMap extends Wizard{
public function getPageTitle(){
return "Map DB Fields";
}
public function index(){
$this->fieldMapping();
}
public function deleteMapping(){
if(is_file(PATH_DIR."dbMaps/".$_GET[dbID].".php")){
@unlink(PATH_DIR."dbMaps/".$_GET[dbID].".php");
}
$this->myDBObj->delete("databases" , "id = '$_GET[dbID]'");
echo $this->myDBObj->getLastError();
$this->myDBObj->delete("sites" , "dbid = '$_GET[dbID]'");
header("Location: .");
}
public function fieldMapping(){
if(count($_POST)){
$this->saveMap();
}
$fieldsData = array();
if(is_file(PATH_DIR."dbMaps/".$_GET[dbID].".php")){
include(PATH_DIR."dbMaps/".$_GET[dbID].".php");
}
$tableFields = array();
{
$tables = $this->dbObj->getTables();
foreach($tables as $table){
$tableFields[$table] = $this->dbObj->getFields($table);
}
$data[tableFields] = $tableFields;
$data[PKs] = $this->dbObj->getPKs();
$data[fieldsData] = $fieldsData;
$this->loadTemplate("FieldMap" , $data);
}
function saveMap(){
$tables = $this->dbObj->getTables();
foreach($tables as $table){
$fields = $this->dbObj->getFields($table);
foreach($fields as $field){
$_DATA['data']['tables'][$table]['fields'][] = $field;
$fldName = $table."_".$field[Field];
if($field["PK"]=="PRI"){
$_DATA['data']['tables'][$table]['primary'] = $field[Field];
}
if($_POST["fk_$fldName"] != ""){
$_DATA['data']['tables'][$table]['links'][$field[Field]] = $_POST["fk_$fldName"];
}
{
$fileContent = var_export($_DATA['data'] , true);
$fileContent = "<?\n\$fieldsData = $fileContent ; \n?>";
$fp = fopen(PATH_DIR."dbMaps/".$_GET[dbID].".php" , "w");
fwrite($fp , $fileContent);
fclose($fp);
header("Location: .");$this->funcPath("MainPage");
}
?>
this is my error message
Parse error: syntax error, unexpected $end in /home/j05ayrw/public_html/viz/Classes/Wizards/FieldMap.php on line 77
i got something wrong and thisd is driving me nuts. any suggestions most welcome!