Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

px_new(3) [php man page]

PX_NEW(3)																 PX_NEW(3)

px_new - Create a new paradox object

SYNOPSIS
resource px_new (void ) DESCRIPTION
Create a new paradox object. You will have to call this function before any further functions. px_new(3) does not create any file on the disk, it just creates an instance of a paradox object. This function must not be called if the object oriented interface is used. Use new paradox_db() instead. RETURN VALUES
Returns FALSE on failure. EXAMPLES
Example #1 Opening a Paradox database <?php if(!$pxdoc = px_new()) { /* Error handling */ } $fp = fopen("test.db", "r"); if(!px_open_fp($pxdoc, $fp)) { /* Error handling */ } // ... px_close($pxdoc); px_delete($pxdoc); fclose($fp); ?> If you prefer the object oriented API, then the above example will look like the following. Example #2 Opening a Paradox database <?php $fp = fopen("test.db", "r"); $pxdoc = new paradox_db(); if(!$pxdoc->open_fp($fp)) { /* Error handling */ } // ... $pxdoc->close(); fclose($fp); ?> SEE ALSO
px_delete(3), px_open_fp(3). PHP Documentation Group PX_NEW(3)

Check Out this Related Man Page

PX_TIMESTAMP2STRING(3)													    PX_TIMESTAMP2STRING(3)

px_timestamp2string - Converts the timestamp into a string.

SYNOPSIS
string px_timestamp2string (resource $pxdoc, float $value, string $format) DESCRIPTION
Turns a timestamp as it stored in the paradox file into human readable format. Paradox timestamps are the number of miliseconds since 0001-01-02. This function is just for convenience. It can be easily replaced by some math and the calendar functions as demonstrated in the following example. PARAMETERS
o $pxdoc - Resource identifier of the paradox database. o $value - Value as stored in paradox database field of type PX_FIELD_TIME, or PX_FIELD_TIMESTAMP. o $format - String format similar to the format used by date(3). The placeholders support by this function is a subset of those supported by date(3) (Y, y, m, n, d, j, H, h, G, g, i, s, A, a, L). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Turn a paradox timestamp into a human readable form <?php $px = px_new(); /* make up a date as it could be stored in */ /* a date field of a paradox db. */ /* 700000 days since 1.1.0000. */ $days = 700000; /* Use the calendar functions to print a */ /* human readable format of the date */ echo jdtogregorian($days+1721425)." "; /* Turn it into a timestamp as it stored in a paradox database */ /* Timestamps are stored in miliseconds since 0001-01-02 */ $stamp = $days * 86400.0 * 1000.0; /* Add one hour */ $stamp += 3600000.0; /* The following will output '7/15/1917 01:00:00'. */ echo px_timestamp2string($px, $stamp, "n/d/Y H:i:s")." "; px_delete($px); ?> The above example will output: 7/15/1917 7/15/1917 01:00:00 The Julian day count as passed to jdtogregorian(3) has a different base of 1.1.4714 b.c. and must therefore be calculated by adding 1721425 to the day count used in the paradox file. Turning the day count into a timestamp is easily done by multiplying with 86400000.0 to obtain miliseconds. SEE ALSO
px_date2string(3), jdtogregorian(3). PHP Documentation Group PX_TIMESTAMP2STRING(3)
Man Page

We Also Found This Discussion For You

1. Programming

Opening a file during FTP

I need to process a file in real time as it is being FTPed from a remote server. In my test environment, I wrote a process that would: 1) Open the file - fopen(filename, "r") 2) Go to the offset where I left off on the previous itteration (fseek) 3) Read 2K blocks and append each block to a... (1 Reply)
Discussion started by: ceaker
1 Replies