aktuelle.kurse/oldies/m133/4_Modulinhalte_und_Uebungen/00-Anwendungen-Beispiele-Uebungen/Datenbank/SQLSRV_Connect_DB_Firma.php
Müller Harald 3fdacd20c0 muh
2022-07-28 09:14:44 +02:00

57 lines
1.4 KiB
PHP

<?php
/*************************************************/
/** M133 DB Firma connect **/
/** Author: M. von Orelli **/
/** Datum: 11.11.2004 **/
/** Version: 1.0 **/
/** Applikation:Get Companies Names **/
/*************************************************/
/*************************************************/
/* Datum ¦ Aenderung **/
/* 11.11.04¦ **/
/* ¦ **/
/* ¦ **/
/* ¦ **/
/* ¦ **/
/*************************************************/
/** Deklaration **/
Define ("CRLF", "\n<br>");
$server = "DB_Firma";
$user = "MvO";
$pass = "vom1";
$toReturn = "";
$Query = "Select FirmenName,PLZ,ORT,Bereich from tbl_Firma";
echo "Connecting SQL Datenbank: ", $server, CRLF;
echo "<br>";
//connect to database
$connectionstring = odbc_pconnect($server,$user,$pass);
// Query RUN to Get ALL Companies
echo "Qery Run", CRLF;
$result = odbc_exec($connectionstring,$Query );
while(odbc_fetch_row($result))
{
for($i=1;$i<=odbc_num_fields($result);$i++)
{
$Text = odbc_result($result,$i);
echo $Text , CRLF;
}
echo "<br>";
}
//disconnect from database
echo "Disconnecting SQL Server:";
odbc_close($connectionstring);
?>