ODBC Help/Suggestions
| From: | Joseph H Blythe | Date: | Thu, 26 Oct 2000 06:56:24 +0000 |
| Subject: | ODBC Help/Suggestions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22078@lists.php.net to get a copy of this message | ||
hey all,
please disregard my last post about the easysoft odbc to odbc bridge as
i finally got this to work :-)
My next problem is the unified odbc functions under php don't seem to
work quite the same as the mysql functions even though they have the
same sort of functionality consider the following code:
<?php
$dsn = "data";
$cnt = @odbc_connect( $dsn, "", "" )
or die ("$php_errormsg<br><b>Connection failed</b>");
$sql = "SELECT * FROM Item";
$qry = @odbc_do($cnt, $sql)
or die ("$php_errormsg<br><b>Execution failed</b>");
$numrows = odbc_num_rows($qry);
$numfields = odbc_num_fields($qry);
$i = 0;
while ($i < $numrows ) {
$j = "0";
while ($j < $numfields) {
$field = odbc_field_name($qry,$j);
$$field = odbc_result($qry,"$i",$field);
$j++;
}
$i++;
echo "All the field_names from the access database here as varaiables
eg: $ItemID";
}
?>
Now if I was using the equivalent mysql functions the above would work
but it outputs nothing quite storage as it generates no errors.
This leads me to my next question, the reason for me using the odbc
functions in the first place is i need to be able to synchronies a
access database on a remote windows box with a mySQL database on a linux
box. I was wondering what people think the best way to do this is some
tables in the database need to also be synched both ways.
Also is there any good example of the php odbc functions.
Any help/suggestions much welcomed,
Regards,
Joseph