Please answer all fields
} ?>//////////////////////////////// // This is where the date is retrieved back out of the database. //////////////////////////////// mysql_pconnect("db2.pair.com","tator_r","password") or die("Unable to connect to SQL server"); mysql_select_db("tator_awtrey") or die("Unable to select database"); $query = "SELECT * FROM guests"; $guests = mysql_query($query) or die("Select Failed!"); //////////////////////////////// // This will loop as long as there are records waiting to be processed. // Notice the plain HTML inside the while loop structure. PHP is flexable // enough to allow you to break into and out of the "code" at any point. //////////////////////////////// while ($guest = mysql_fetch_array($guests)) { ?>
|
Name: echo $guest['guest_name']; ?> |
//////////////////////////////// // The database has a timestamp record type that we can use to show the // date the guestbook was filled out. //////////////////////////////// $datefromdb = $guest['guest_time']; $year = substr($datefromdb,0,4); $mon = substr($datefromdb,4,2); $day = substr($datefromdb,6,2); $hour = substr($datefromdb,8,2); $min = substr($datefromdb,10,2); $sec = substr($datefromdb,12,2); $orgdate = date("l F dS, Y h:i A",mktime($hour,$min,$sec,$mon,$day,$year)); echo "Date: $orgdate\n"; ?> | |
|
echo $guest['guest_message']; ?> | ||
} ?>