[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mysql mit php: kein connect



Hallo Janto,

* Janto Trappe <janto@sylence.de> [21-02-02 00:40]:

> | <?php
> | $db =3D @mysql_connect("localhost","root","password");
> | if ($db) {
> |  echo "Connect! $db";
> | } else {
> |  echo "Error!";
> | }
> | @mysql_close($db);
> | ?>

Das @ solllte nur eine Fehlerausgabe unterdrücken. 
Bei mir klappt es etwa so, Daten musst Du anpassen.
Kleines Beispiel, ausschmücken kannst Du es selber. ;-)

$data_base = "archiv";
$verbindung = @mysql_connect($data_host, $nutzer, $passwort);

if (!$verbindung){
        echo "<h2>Keine Verbindung zu $data_host möglich!</h2>";
        exit;
  } else {
        echo "<h2>Datenbank: $data_base</h2>";
}

$abfrage = "SELECT * FROM archiv";
$ergebnis = mysql_db_query($data_base,$abfrage,$verbindung);

if (!$ergebnis){
        echo "Abfrage fehlgeschlagen!";
}
while (list($id, $titel, $inhalt) = mysql_fetch_row($ergebnis))
        echo "$id<br>\n";
        echo "$titel<br>\n";
        echo $inhalt<br>\n;

mysql_close($verbindung);
 
> | 020220 22:24:51  mysqld started
> | Cannot initialize InnoDB as 'innodb_data_file_path' is not set.
> | If you do not want to use transactional InnoDB tables, add a line
> | skip-innodb

Jetzt wo Du es hier schreibst sehe ich das auch.
Ist mir noch garnicht aufgefallen seit dem letzten Update.

Gruss Uwe

Attachment: pgpMuxQZZ7xEh.pgp
Description: PGP signature


Reply to: