Hallo liebe Community,
ich benötige eine Software für unsere Schulbibliothek!
Gerade eben habe ich selber ne kleine Seite gebastelt, die an eine mySQL-Datenbank die Daten schickt.
Die Datei heißt "index.php".
Wenn ich sie im Browser über bplaced (http://thgbiblio.bplaced.net/biblio/index.php) aufrufe erscheint die Seite wenn ich dann aber auf Absenden klicke, kommt folgende Meldung:
Warning: mysql_query() [function.mysql-query]: Access denied for user ''@'localhost' (using password: NO) in /users/thgbiblio/www/biblio/index.php on line 51
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /users/thgbiblio/www/biblio/index.php on line 51
Access denied for user ''@'localhost' (using password: NO)
ich benötige eine Software für unsere Schulbibliothek!
Gerade eben habe ich selber ne kleine Seite gebastelt, die an eine mySQL-Datenbank die Daten schickt.
Die Datei heißt "index.php".
Wenn ich sie im Browser über bplaced (http://thgbiblio.bplaced.net/biblio/index.php) aufrufe erscheint die Seite wenn ich dann aber auf Absenden klicke, kommt folgende Meldung:
Warning: mysql_query() [function.mysql-query]: Access denied for user ''@'localhost' (using password: NO) in /users/thgbiblio/www/biblio/index.php on line 51
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /users/thgbiblio/www/biblio/index.php on line 51
Access denied for user ''@'localhost' (using password: NO)
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>THG Schulbibliothek</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div id="webseite"> <div id="header"> <h1>THG Bibliotheksverwaltung</h1> </div> <div id="main"> <div id="left"></div> <div id="right"> <?php $db = mysqli_connect("localhost", "thgbiblio_biblio", "xxxxxx", "thgbiblio_biblio"); if(!$db) { exit("Verbindungsfehler: ".mysqli_connect_error()); } ?> <form method="POST"> Titel: <input type="text" name="titel" /><br /> Autor: <input type="text" name="autor" /><br /> ISBN: <input type="text" name="isbn" /><br /> Barcode: <input type="text" name="barcode" /><br /> Status: <select name="status"> <option value="verfuegbar">verfuegbar</option> <option value="verliehen">verliehen</option> <option value="gesperrt">gesperrt</option> </select><br /> <input type="submit" name="submit" /> </form> <?php if(isset($_POST['submit'])) { $titel = htmlentities($_POST['titel']); $autor = htmlentities($_POST['autor']); $isbn = htmlentities($_POST['isbn']); $barcode = htmlentities($_POST['barcode']); $status = htmlentities($_POST['status']); $sql = "INSERT INTO thgbiblio_biblio VALUES( '$titel', '$autor', '$isbn', '$barcode', '$status' )"; $query = mysql_query($sql) or die(mysql_error()); if($query == TRUE) { echo "Das Medium wurde erfolgreich eingefuegt!"; } else { echo "Das Medium konnte nicht eingetragen werden!"; } } ?> </div> </div> <div id="footer"> (c) 2014 by Dennis Burgard </div> </div> </body> </html>
Kommentar