简体   繁体   中英

How do I connect and inserting records into pervasive sql in php

I am working on a PHP project that needs to send data to Pastel.

How to connect to pastel's pervasive and insert the records directly for the pastel to use?

Using PHP on Windows is relatively easy. You'll need to create an ODBC DSN pointing to your database. Then, you can use ODBC to connect. Here's a very simple sample using the PSQL demodata:

<html>
<head>
<title>Title</title>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META NAME="Author" CONTENT="Mirtheil Software">
</head>
<body>
<h1>Title</h1>
<?php
$conn=odbc_connect("demodata","","");
$rs=odbc_exec($conn,"select * from Class");
echo "<table border=1>\n";
$numfields = odbc_num_fields($rs);
for($i=1;$i<=$numfields;$i++){
    $fn=odbc_field_name($rs,$i);
    echo "<th>$fn</th>";
}
echo "\n";
while(odbc_fetch_row($rs)){
    echo "<tr>\n";
    for($i=1;$i<=$numfields;$i++){
    $fv=odbc_result($rs,$i);
    echo "<td>$fv</td>"; 
}
echo "</tr>\n";
}
echo "</table>\n";
echo "<p>Number of Fields: $numfields</p>\n";
?>
</body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM