Recover Database from Project

hi
i lost my MySQL database and i have not any backup,
before it, i made a phpmaker project by this database.
can i restore or recover tables and fields structure from phpmaker project file?

You can only recreate it according to the table/field names and the data type in the project.

i write below php script to convert PHPMaker project file to MySQL query to recover table structurenotes:
1- firs rename your project file to “project.pmp.xml” and copy it near php script file.
2- this script only recover Table structure and not work for view.
3- this script only recover FiledName,FieldType & FieldSize. other attribute must be set manually (PRIMARY KEY,AUTO_INCREMENT,NOT NULL,…)
4- delete all table before execute this SQL
5- after run this script, delete last coma before “,) ENGINE=MyISAM…”

<?php
$xml = simplexml_load_file("project.pmp.xml");
$nodes = $xml->xpath('/Project/Database/Table');
foreach ($nodes as $table)
	{
	if ($table['TblName']=='TABLE')
		{
		echo "CREATE TABLE `" . $table['TblName'] . "` (";
		foreach ($table->children() as $field)
			{
			echo "`" .$field['FldName']. "` " .$field['FldTypeName'];
			if (!($field['FldTypeName']=='DATETIME' || $field['FldTypeName']=='DATE' || $field['FldTypeName']=='TIME' || $field['FldTypeName']=='TIMESTAMP' || $field['FldTypeName']=='LONGTEXT' || $field['FldTypeName']=='TEXT' || $field['FldTypeName']=='TINYTEXT')) 
				echo "(" .$field['FldSize']. ")";
			echo ",";
			}
		echo ") ENGINE=MyISAM DEFAULT CHARSET=utf8;";
		}
	}
?>

Hello, I know this is a old question but I had the same problem and fixed using ghasembaghi’s code but I’d had to do some changes to work in v2021.
You have to create a folder and create a xml.php file. Than paste your pmp files into this new folder and rename to ‘project.pmp.xml’ then paste this code into your xml.php file:

<?php
$xml = simplexml_load_file("project.pmp.xml");
$nodes = $xml->xpath('/Project/Database/Table');
foreach ($nodes as $table) {
    if ($table['TblType'] == 'TABLE') {
        echo "CREATE TABLE " . $table['TblName'] . " (";
        $total_tbl = count($table->children());
        $c = 0;
        foreach ($table->children() as $field) {
            echo "" . $field['FldName'] . " " . $field['FldTypeName'];
            if (!($field['FldTypeName'] == 'DATETIME' || $field['FldTypeName'] == 'DATE' || $field['FldTypeName'] == 'TIME' || $field['FldTypeName'] == 'TIMESTAMP' || $field['FldTypeName'] == 'LONGTEXT' || $field['FldTypeName'] == 'TEXT' || $field['FldTypeName'] == 'TINYTEXT')){
                echo "(" . $field['FldSize'] . ")";
            }
            $c++;
            if( $c < $total_tbl){
                echo ",<br/>";   
            }
        }

        echo "<br/>) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
        echo "<br/>";
        echo "<br/>";
    }
}

May this help some one.

In 2024, it is really help me. Thanks, a lot.