how can I open .dat and .idx files?

2

How can I open files and tables with extensions .DAT and .IDX using php?

I am making a web application and I need to extract data from a database created by another program but I have not been able to do it, the files of the tables are saved in files with dat and idx , here is the script that I use to try to connect but it does not give me an error but if it stays loading please if you can help me

<?php
   $db = odbc_connect("DRIVER={DBISAM 4 ODBC Driver}; ConnectionType=Local; CatalogName=C:\direcciondelacarpetadondeseguardanlastablas\Data;","","");

   $res = odbc_exec($db,"SELECT * FROM customers");
   echo odbc_num_rows($res)." rows found";

   while($row = odbc_fetch_array($res)) {
      print_r($row);
   }
?>
    
asked by alexander123 30.03.2016 в 15:34
source

1 answer

0

Well I really do not understand your question, what you show in your code is the connection to a data source, in this case DBISAM, and nowhere do I see that you open the .dat or .idx files you mention.

Depending on how the data was saved in the .dat file, you can read it through the fread function.

<?php
$fr   = fopen('/path/to/myfile.dat', 'r');
$data = fread($fr, 1024);
fclose($fr);
?>

You can visit this link for more information: link

Or review this question in stackoverflow in English. link

    
answered by 30.03.2016 в 16:35