<form action="comment_box.php" method="post">
Name &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="MWDname" /><br />
Message <input type="text" name="MWDmessage" /><br />
<input type="submit" />
</form>

<?php
$MWDsqlserver = "yourmysqlservername_probably_localhost";
$MWDsqluserid = "yourusername";
$MWDsqlpassword = "yourpassword";
$MWDsqldatabase = "yourdatabase";

if(!($MWDCon = mysqli_connect($MWDsqlserver, $MWDsqluserid, $MWDsqlpassword)
or die(mysql_error()))) { printf("Errormessage: %s\n", mysqli_error($MWDCon)); } if(!(mysqli_select_db($MWDCon,$MWDsqldatabase) or die(mysql_error()))) { printf("Errormessage: %s\n", mysqli_error($MWDCon)); } // Create a MySQL table in the selected database if(!(mysqli_query($MWDCon,"CREATE TABLE IF NOT EXISTS MWDTbComments( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), MWDname VARCHAR(30), MWDmessage VARCHAR(200))")or die(mysql_error()))) { printf("Errormessage: %s\n", mysqli_error($MWDCon)); } if(!(mysqli_query($MWDCon,"INSERT INTO MWDTbComments (MWDname, MWDmessage)
VALUES('$_POST[MWDname]', '$_POST[MWDmessage]' ) "
)or die(mysql_error()))) { printf("Errormessage: %s\n", mysqli_error($MWDCon)); } if(!($result = mysqli_query($MWDCon,"SELECT * FROM MWDTbComments"))) { printf("Errormessage: %s\n", mysqli_error($MWDCon)); } while($row = mysqli_fetch_array($result)) { echo "<br />
"; echo $row['MWDname']; echo "<br /> " ; echo $row['MWDmessage']; echo "<br />"; } mysqli_free_result($result); mysqli_close($MWDCon); ?>








  MylesWebDesign.co.uk   ©2010