Hello,
Is it possible to connect to an ADS DBFCDX database via PHP? If so, does anyone have sample code they can provide?
//sample appending records to a dbf/ntx table:
if ( !DDconnect( _DATA_DICT, $rConn ) ) die( "<br> Error connecting to Database.<br>" ) ;
$rStmt = ads_prepare( $rConn, "INSERT INTO log ( [UserId], [login_date], [ip] ) VALUES( ?, now(), ? )" );
$aParms = array( 1 => $user, 2 => $_SERVER[ 'REMOTE_HOST' ].$_SERVER[ 'REMOTE_ADDR' ] );
$rResult = ads_execute( $rStmt, $aParms );
ads_close( $rConn );
//----------------------------------------------------------------------------------------------------------------------
function DDconnect( $db, &$rConn ) {
$user = $_SESSION[ 'userid' ];
$pass = $_SESSION[ 'password' ];
$rConn = ads_connect( $db, $user, $pass, SQL_CURSOR_DYNAMIC );
return is_resource( $rConn );
}
$aParms= array( 1 => "[Save Command]:<".date("M-d-y h:m:sa").">\n".$_POST[ 'solution' ],
2 => $user,
3 => $_POST[ 'status' ] == "Open" ? FALSE :TRUE ,
4 => $case,
5 => $isTech );
$query = "UPDATE cases SET [Solution] = ?, [Solution_date] = now(),
[Tech] = ?, [Status] = ? WHERE [Case_no] = ? AND ? = TRUE" ;
$rStmt = ads_prepare( $rConn, $query );
$rResult = ads_execute( $rStmt, $aparms ) ;
$query = "SELECT [comments], [time_stamp], [sequence] FROM ticket_feedback ".
"WHERE Case_no = ? ORDER BY [sequence]" ;
$rStmt = ads_prepare( $rConn, $query );
$aparms = array( 1 => $_GET[ 'case' ] );
$rResult = ads_execute( $rStmt, $aparms ) ;
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 72 guests