23. april 2005 - 13:35Der er
39 kommentarer og 1 løsning
Fejlen i scriptet??
hvad er fejlen??
<?php/** * Create the table in your MySQL database: * * CREATE TABLE guests ( * id int(10) NOT NULL auto_increment, * name varchar(50) NOT NULL, * message varchar(255) NOT NULL, * date timestamp(14) NOT NULL, * PRIMARY KEY (id) * ) * * Change the database login settings to your own * * The script is now ready to run */// Change these to your own database settings$host = "mysql1.unoeuro.com";$user = "f_hasager_dk";$pass = "otis";$db = "f_hasager_dk_db";mysql_connect($host, $user, $pass) OR die ("Could not connect to the server.");mysql_select_db($db) OR die("Could not connect to the database."); $name = stripslashes($_POST['txtName']);$message = stripslashes($_POST['txtMessage']);if (!isset($_POST['txtName'])) { $query = "SELECT id, name, message, DATE_FORMAT(date, '%D %M, %Y @ %H:%i') as newdate FROM guests ORDER BY id DESC"; $result = mysql_query($query); while ($row = mysql_fetch_object($result)) {?><p><strong><?php echo $row->message; ?></strong><br /> Posted af <?php echo $row->name; ?> klokken <?php echo $row->newdate; ?> Mail <?php echo $row->maile; ?></p> <?php } ?> <p>Post en meddelse </p> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <p> <label for="txtName">Navn:</label> <br /> <input type="text" title="Enter your name" name="txtName" /></p> <label for="txtName">E-Mail:</label> <br /> <input name="txtMaile" type="text" id="txtMaile" title="Enter your name" /> </p> <p> <label for="txtMessage">Meddelelse:</label> <br /> <textarea title="Enter your message" name="txtMessage"></textarea></p> <p><label title="Send your message"> <input type="submit" value="Send" /></label></p> </form><?php}else { // Adds the new entry to the database $query = "INSERT INTO guests SET message='$message', name='$name', date=NOW()"; $result = mysql_query($query); // Takes us back to the entries $ref = $_SERVER['HTTP_REFERER']; header ("Location: $ref");}?>
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
CREATE TABLE guests ( id int(10) NOT NULL auto_increment, name varchar(50) NOT NULL, message varchar(255) NOT NULL, date timestamp(14) NOT NULL, PRIMARY KEY (id) )
CREATE TABLE guests ( id int(10) NOT NULL auto_increment, name varchar(50) NOT NULL, message varchar(255) NOT NULL, date timestamp(14) NOT NULL, PRIMARY KEY (id) )
Det du har postet skifter du ud med: <?php /** * Create the table in your MySQL database: * * CREATE TABLE guests ( * id int(10) NOT NULL auto_increment, * name varchar(50) NOT NULL, * message varchar(255) NOT NULL, * date timestamp(14) NOT NULL, * PRIMARY KEY (id) * ) * * Change the database login settings to your own * * The script is now ready to run */// Change these to your own database settings $host = "mysql1.unoeuro.com"; $user = "f_hasager_dk"; $pass = "DITEGETPASSWORD"; $db = "f_hasager_dk_db"; mysql_connect($host, $user, $pass) OR die ("Could not connect to the server."); mysql_select_db($db) OR die("Could not connect to the database."); $name = stripslashes($_POST['txtName']); $message = stripslashes($_POST['txtMessage']); if (!isset($_POST['txtName'])) { $query = "SELECT id, name, message, DATE_FORMAT(date, '%D %M, %Y @ %H:%i') as newdate FROM guests ORDER BY id DESC"; $result = mysql_query($query); while ($row = mysql_fetch_object($result)) { ?><p><strong><?php echo $row->message; ?></strong><br /> Posted af <?php echo $row->name; ?> klokken <?php echo $row->newdate; ?> Mail <?php echo $row->maile; ?></p> <?php } ?> <p>Post en meddelse </p> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <p> <label for="txtName">Navn:</label> <br /> <input type="text" title="Enter your name" name="txtName" /></p> <label for="txtName">E-Mail:</label> <br /> <input name="txtMaile" type="text" id="txtMaile" title="Enter your name" /> </p> <p> <label for="txtMessage">Meddelelse:</label> <br /> <textarea title="Enter your message" name="txtMessage"></textarea></p> <p><label title="Send your message"> <input type="submit" value="Send" /></label></p> </form> <?php } else { // Adds the new entry to the database $query = "INSERT INTO guests SET message='$message', name='$name', date=NOW()"; $result = mysql_query($query); // Takes us back to the entries $ref = $_SERVER['HTTP_REFERER']; header ("Location: $ref"); } ?>
Warning: Cannot modify header information - headers already sent by (output started at /var/www/f-hasager.dk/public_html/marc/gb.php:7) in /var/www/f-hasager.dk/public_html/marc/gb.php on line 333
<?php /** * Create the table in your MySQL database: * * CREATE TABLE guests ( * id int(10) NOT NULL auto_increment, * name varchar(50) NOT NULL, * message varchar(255) NOT NULL, * date timestamp(14) NOT NULL, * PRIMARY KEY (id) * ) * * Change the database login settings to your own * * The script is now ready to run */// Change these to your own database settings $host = "mysql1.unoeuro.com"; $user = "f_hasager_dk"; $pass = "otis"; $db = "f_hasager_dk_db"; mysql_connect($host, $user, $pass) OR die ("Could not connect to the server."); mysql_select_db($db) OR die("Could not connect to the database."); $name = stripslashes($_POST['txtName']); $message = stripslashes($_POST['txtMessage']); if (!isset($_POST['txtName'])) { $query = "SELECT id, name, message, DATE_FORMAT(date, '%D %M, %Y @ %H:%i') as newdate FROM guests ORDER BY id DESC"; $result = mysql_query($query); while ($row = mysql_fetch_object($result)) { ?><p><strong><?php echo $row->message; ?></strong><br /> Posted af <?php echo $row->name; ?> Den <?php echo $row->newdate; ?> </p> <?php } ?> <p>Post en meddelse </p> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <p> <label for="txtName">Navn:</label> <br /> <input type="text" title="Enter your name" name="txtName" /></p> <p> <label for="txtMessage">Meddelelse:</label> <br /> <textarea title="Enter your message" name="txtMessage"></textarea></p> <p><label title="Send your message"> <input type="submit" value="Send" /></label></p> </form> <?php } else { // Adds the new entry to the database $query = "INSERT INTO guests SET message='$message', name='$name', date=NOW()"; $result = mysql_query($query); // Takes us back to the entries $ref = $_SERVER['HTTP_REFERER']; print '<meta http-equiv="refresh" content=1;url="'<? echo $ref ?>'">'; } ?>
Det du kunne gøre at at ændre det til: print 'Tak for din besked, du bliver stillet videre til gæstebogsoversigten om et øjeblik<br><br>'; print 'Skulle du ikke komme videre kan du trykke <a href="'.$ref.'">her</a>'; print '<meta http-equiv="refresh" content=3;url="'.$ref.'">';
Ej hvor fedt det skal jeg have på. Mange tusinde tak!
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.