Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Aufruf einer Access DB aus PHP

Empfohlene Antworten

Veröffentlicht

Hallo!

Wie ist es möglich von PHP aus auf eine AccessDB zuzugreifen?

:confused:

DB und iis-server vorhanden

Danke!

ueber odbc vllt. musst mal schauen... www.php.net/odbc

ansonsten wuesste ich net, dass das geht...

dafuer hat ja m$ asp erfunden...

greetz

Das müßte via ODBC schon gehen - vorausgesetzt, daß es auch auf dem Server installiert ist :)

Ich würde auf einem IIS aber auch eher mit ASP entwickeln - ich weiß nicht, ob PHP als Modul dort genauso performant ist.

Oft wird PHP auf IIS nämlich einfach als CGI.Variante eingesetzt und dann ist ASP um einiges fixer.

Evil

Hi du,

hab gerade das gleiche Problem hast du schon eine Lösung gefunden ??? Ich hab im PHP Tutorial http://www.php.net/manual/en/function.odbc-connect.php

ganz unten ein paar Lösungsmöglichkeiten entdeckt, hoffe das hilft dir weiter :-)

P.S. PHP is schon toll warum soll man für eine Plattform programmieren wenn es auch für alle geht ! Nur mal so für die ASP Verfechter :)

Fight-Angel

hi!

unter windows, kann manns auch mit com und ado machen.

grüsse


// ADO-Verbindung öffnen
$conn = @new com("ADODB.Connection") or die("Can not start ADO");

// Verbindungsstring DBQ=dbname.mdb
define (CSTR, "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\\Inetpub\\wwwroot\\Websites\\TestWeb\\test.mdb");

// Verbindung zur DB
$inConn = $conn->Open(CSTR,2);

if ($conn->State == 1)
{
$res = $conn->Execute("SELECT * FROM Tabelle1");
$num_columns = $res->Fields->Count();

for ($i=0; $i < $num_columns; $i++)
$fld[$i] = $res->Fields($i);

$rowcount = 0;
while (!$res->EOF)
{
for ($i=0; $i < $num_columns; $i++)
echo $fld[$i]->value . " ";
echo "<br>";
$rowcount++;
$res->MoveNext();
}
}
else
echo "Fehler";

// Speicher Freigeben
$conn->Release();
$res = null;
$conn = null;
[/PHP]

Danke für eure Antworten!!

Nachdem sich der Rechner mit IIS usw. verabschiedet hat versuch ich das ganze mit PHPTriad.

Nun hab ich folgende Situation: Access DB in ODBC eingebunden, Aufruf mit odbc_connect und am Bildschirm erscheint einfach nur „weis“. Keine Fehlermeldung, keine Bestätigung das es läuft. Schau ich in den Quelltext erscheint die html- Formatierung. (nicht mit PHP eingegeben)

Woran kann das noch liegen????? Muss ev. noch was anders mit eingebunden werden? Muss vielleicht in den ODBC- Einstellungen noch was geändert werden?

Grüße

Orchidee

Hab’s gerade geschafft!!!!

Das hier hat mich auf die richtige Spur gebracht. Was jetzt letztlich wirklich anders ist weis ich nicht.

http://php.weblogs.com/odbc

und das der Code (kopiert)

<?

// 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);

?>

Grüße

Orchidee

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.