# connect to a DSN "mydb" with a user and password "marin"
$connect = odbc_connect("mydb", "marin", "marin");
# query the users table for name and surname
$query = "SELECT name, surname FROM users";
# perform the query
$result = odbc_exec($connect, $query);
# fetch the data from the database
while(odbc_fetch_row($result)){
$name = odbc_result($result, 1);
$surname = odbc_result($result, 2);
print("$name $surname\n");
}
# close the connection
odbc_close($connect);
?>
Showing posts with label PHP Connect with ODBC how?. Show all posts
Showing posts with label PHP Connect with ODBC how?. Show all posts
Wednesday, November 14, 2007
Connecting to ODBC and PHP
Subscribe to:
Posts (Atom)