hallo, habe folgendes Problem:
Wenn ich versuche die datenbank einzubinden erscheint immer der Fehler das die Datenbank nicht existiert, jedoch existiert sie.
bitte um hilfe:
INDEX.HTML:
<html>
<head>
<title>JavaScript-Test</title>
<link rel="stylesheet" type="text/css" href="formate.css">
<script src="funktion.js" type="text/javascript"></script>
</head>
<body>
<div id="links">
<form action="eintragen.php" method="post">
<input type="text" name="name1">
<input type="text" name="pwd2">
<input type="submit" name="eintragen" value="eintragen">
</form>
</div>
<div id="rechts">
<a href="anzeigen.php">anzeigen</a>
</div>
<div id="unten">
<form name="Formular" action="">
<input type="text" name="zahl1" size="3">
<input type="text" name="zahl2" size="3">
<input type="button" value="Rechnen" onclick="Quadrat()">
</form>
</div>
</body>
</html>
FORMATE.CSS:
#links{
background-color:lightgrey;
height:290px;
width:140px;
padding:10px;
position:absolute;
}
#rechts{
background-color:lightgreen;
width:90px;
height:290px;
padding:10px;
margin-left:170px;
}
#unten{
}
Evtl noch hier fehler?
<?php
mysql_connect("localhost","root","") or die ("Keine Verbindung moeglich");
mysql_select_db("leute") or die ("Die Datenbank existiert nicht.");
$inhalt = mysql_query("SELECT * FROM tah");
while ($zeile = mysql_fetch_array($inhalt))
{
echo $zeile[id] . " " . $zeile[name]. " " . $zeile[pwd] . "<br />";
}
?>
___________________
<?php
mysql_connect("localhost","root","") or die ("Keine Verbindung moeglich");
mysql_select_db("leute") or die ("Die Datenbank existiert nicht.");
$name = $_POST["name1"];
$pwd = $_POST["pwd2"];
$eintragen = mysql_query("INSERT INTO tah(name,pwd)VALUES('$name','$pwd')");
echo "Schreiberfolg: $ergebnis <br>";
?>
oder das hier geht auch nicht:
<html>
<body>
<LINK rel="stylesheet" type="text/css" href="format.css">
<form action = "abfrage.php" method = "post">
<h3>Formular zur Eingabe von Suchkriterien</h3><p>
<h4>Ausgabe der Kunden nach PLZ:</h4><p>
<table >
<tr>
<td>Von PLZ </td>
<td> <input name = "plz1"></td>
</tr>
<tr>
<td> Bis PLZ </td>
<td><input name = "plz2"> </td>
</tr>
</table>
<input type="radio" name="sortiert" value="plz3" checked>
Sortiert nach Postleitzahl <br>
<input type="radio" name="sortiert" value="knr">
Sortiert nach Kundennummer
<input type = "submit">
<input type = "reset">
</form>
</body>
</html>
<?php
$plz1 = $_POST[plz1];
$plz2 = $_POST[plz2];
$sortiert = $_POST[sortiert];
$verbindung = mysql_connect("localhost","root","");
IF (!$verbindung) die ("Keine Verbindung zu localhost möglich!");
$bank = mysql_select_db("firma");
IF (!$bank) die ("Keine Datenbank web vorhanden!");
echo mysql_error();
IF ($sortiert == "plz3")$sort = plz;
IF ($sortiert == "knr")$sort = knr;
$sqlab = "select knr, name, plz, ort, umsatz from kunden
where plz >= $plz1
and plz <= $plz2
order by $sort ";
$res = mysql_db_query("firma", $sqlab);
$num = mysql_num_rows($res);
echo "$num Datensätze gefunden<br>";
echo "<table border>";
echo "<tr> <td>Kdnr</td></td> <td>Name</td>";
echo "<td>Plz</td><td>Ort</td><td>Umsatz</td></tr>";
while ($zeile = mysql_fetch_array($res))
{
echo "<tr><td>$zeile[knr]</td>";
echo "<td>$zeile[name]</td>";
echo "<td>$zeile[plz]</td>";
echo "<td>$zeile[ort]</td>";
echo "<td>$zeile[umsatz]</td></tr>";
}
echo "</table>";
mysql_close($verbindung);
?>