that didn't work, It will display all the towers at once and the error message i made
$result = @mysql_query("$query") or die('<p class="error">There was an unexpected error grabbing data from the database.</p>');
here you all my php code, I modified a shoutbox for this project
<?php
$self = $_SERVER['PHP_SELF'];
include ('db.php');
$connect = mysql_connect($host,$username,$password) or die('<p class="error">Unable to connect to the database server at this time.</p>');
mysql_select_db($database,$connect) or die('<p class="error">Unable to connect to the database at this time.</p>');
if(isset($_POST['send'])) {
if(empty($_POST['name']) || empty($_POST['height']) || empty($_POST['post'])) {
echo('<p class="error">You did not fill in a required field.</p>');
} else {
$name = htmlspecialchars(mysql_real_escape_string($_POST['name']));
$hieght = htmlspecialchars(mysql_real_escape_string($_POST['hieght']));
$disc = htmlspecialchars(mysql_real_escape_string($_POST['disc']));
$sql = "INSERT INTO shouts SET name='$name', hieght='$hieght', disc='$disc';";
if (@mysql_query($sql)) {
echo('<p class="success">tower added!</p>');
} else {
echo('<p class="error">There was an unexpected error when posting your tower.</p>');
}
}
}
$t= (int) $_GET['tower'];
$query = "SELECT * FROM towers where tower_id=$t ORDER BY `id` DESC LIMIT 8;";
$result = @mysql_query("$query") or die('<p class="error">There was an unexpected error grabbing shouts from the database.</p>');
?><ul><?
while ($row = mysql_fetch_array($result)) {
$ename = stripslashes($row['name']);
$ehieght = stripslashes($row['hieght']);
$edisc = stripslashes($row['disc']);
echo('<li><div class="meta"><h2>'.$ename.'</h2></div><div class="shout"><p>'.$edisc.'</p></div></li>');
}
?></ul><?
?>
before that and after it just pure html/css