If you want to do this get an old version of XAMPP
Update: New versions of XAMPP for Windows don't have the PHP paradox module. The latest I could find that contained the necessary php/ext/php_paradox.dll file was XAMPP for Windows 1.7.0
Windows (XP) provides a Paradox Driver that when used with Access can read a *.db file by either linking or importing the table. However I found that when using ADODB and VB Script to connect to the Paradox DB a time field came out as 12:00 AM. I Googled and tried all sorts of things to get the raw milliseconds-from-midnight out of the db and not the erroneous 12:00 AM but found no solution.
I thought perhaps I could use Perl but Google was strangely silent regarding both the pro's and con's.
PHP has an interface to the Paradox Library methods. I tried to download PHP on it's own and then install pxlib using pear install paradox
and pecl install paradox
but they all failed aswell.
Enter XAMPP. This is a easy to install bundle of MySQL, PHP, APACHE etc. Where it comes in handy for me is that it has a heap of sample scripts showing how to connect to a paradox database, query it's properties and also export an Excel spreadsheet to a browser.
After installing XAMPP Windows 1.6.6a or XAMPP for Windows 1.7 and spending a half day hacking on the included sample scripts and learning a few tricks from the php.net documentation. I have a PHP based query form which then passes it's values to a PHP paradox script which in turn reads the database and returns a nicely formatted Excel spreadsheet to the calling browser.
A word of warning don't download the WAMPP 2.2 package as I did as it doesn't have Paradox support. It looks like paradox support was removed in 2009.
How to Check if your version of PHP has Paradox Support
create a php file "info.php" somewhere in your webroot
<?php phpinfo(); ?>
Access it via your browser http://yourwebserver/info.php
You know you have Paradox support if you see a section similar to this
I did all this on Windows XP Pro SP2.
You don't use SELECT * to query using the paradox db methods...
When using the php methods you need to loop through the entire table.
such as ...
<?php
// path to your db
$trandb = "C:/path/to/yourdb/dbname.db";
// check to make sure you can create a paradox object
// exit if not
if(!$pxdoc = px_new()) {
exit("Unable to create a px_new object");
/* Error handling */
}
// open the paradox database using fopen and return a file pointer
// "r" means readonly
$fp = fopen($trandb, "r") or exit("Cannot open $trandb");
// now use paradox method to open the file
// pointer and assign it to the pxdoc object
if(!px_open_fp($pxdoc, $fp)) {
exit("px_open_fp error");
/* Error handling */
}
// grab some information from the paradox db
// $myArray = px_get_info($pxdoc);
// if you want to print details about the db use
// this commented code
// echo "DB Info: preformattag";
// print_r($myArray);
// echo "End DB Info. endpreformattag" ;
// This code would write the entire db to screen
// reset ($myArray);
// while (list($key, $val) = each($myArray)) {
// echo "$key =--> $val\n
";
// }
// do a check for the number of records in the db
$int = px_numrecords($pxdoc);
//reset my record to nothing
$myRecord = "";
// I'm looping back through the db from newest to oldest
// hence the $i--
for ($i = $int - 1 ; $i > 0; $i--) {
// get each record in turn
$myRecord = px_get_record($pxdoc, $i) ;
//reset the array back to it's first element
reset ($myRecord);
//grab the transaction date from the record
// so we can compare it to our constraints
$record_date =
strtotime(
px_date2string ($pxdoc, $myRecord["TranDate"],"Y-m-d")
);
if (( $record_date >= $fromdate )
and ( $record_date <= $todate)) {
// now we populate the $fields array
// with the correct values converting
// them if necessary
$fields[0] = $myRecord["Customer"];
$fields[1] = $myRecord["CustName"];
$fields[2] = $myRecord["Vehicle"];
$fields[3] = $myRecord["Item"];
$fields[4] = $myRecord["Docket"];
$fields[5] = px_date2string (
$pxdoc, $myRecord["TranDate"], "d/m/Y"
);
$fields[6] = px_timestamp2string(
$pxdoc, $myRecord["TranTime"], "h:i:sA"
);
$fields[7] = $myRecord["Order"];
$fields[8] = $myRecord["Source"];
$fields[9] = $myRecord["SourceName"];
$fields[10] = $myRecord["Destination"];
$fields[11] = $myRecord["DestName"];
$fields[12] = $myRecord["Net"];
$fields[13] = $myRecord["CancelledDocket"];
//set the pointer back to the first element of the array
reset($fields);
while (list($key, $val) = each($fields)) {
//when writing to screen you
//can use this for creating tabs
//tab is "\t"
echo "
$key: $val";
}
}
}
//Close the pxlib objects
px_close($pxdoc);
px_delete($pxdoc);
//Close the actual file
fclose($fp);
//not sure what this exit does but
// it was used in the excel writer code
// so I include it here also
exit;
Could you explain more detail how to "hacking on the included sample scripts and learning a few tricks from the php.net documentation". Or could you upload that script. Thank before and after. I'm so confused
Once you have installed XAMPP the included sample scripts are located in
:\xampp\htdocs\xampp\special\paradox\. They show how to connect and query the paradox db.
You connect to the XAMPP installation via a webbrowser (http://ip_of_xampp_server) and there are links to all the different examples
Now I can connect to Paradox. But i don't know how to query the Paradox table such as "SELECT * FROM tblUser". I try to find the way in PHP.net but I found only the Paradox function.
Could you give me the sample code of this method?
Regards,
Have you tried query the paradox using select? any way in php.net or do you have sample code
No the PHP Paradox methods do not work that way.
You could however create your own PHP classes that would work similarly.
Further documentation is available at http://au.php.net/paradox and the library that the PHP uses is at http://pxlib.sourceforge.net/documentation.php
GREAT!,Thx so much!
I read your article and installed xampp. First, tried with 1.7.7 and then with 1.6.6. In both cases, I could not find the paradox.dll, i.e., paradox driver was not installed. What could I be doing wrong? Is it possible to email me a copy a copy of php_paradox.dll.
Thanks,
Anil
When I look into my \xampp\readme_en.txt file I have this version "###### ApacheFriends XAMPP (Basispaket) version 1.7.0 ######"
If you have a look under \xampp\php\ext it should be there.
You may also have to uncomment the extension=php_paradox.dll in xampp\php\php.ini
My php.ini extension section looks as follows:
i try install on windows 7 and windows 8.1
both have no php_paradox, i also try xampp 5.6.15 and xampp 7.0.2 both wont work..
what's wrong ? can you help me?
thanks,
Hans
You need a really old version which you can download from https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/