Legg inn innlegg i skjema under..
if ($notall == 1) { ?>
Vennligst fyll ut alle feltene
} ?>//////////////////////////////// // This is where we connect to the database for reading. //////////////////////////////// mysql_pconnect("mysql.stud.ntnu.no","torivaha_kull23","einstein") or die("Unable to connect to SQL server"); mysql_select_db("torivaha_kull23") or die("Unable to select database"); //////////////////////////////// // This is where we count the number of entries. //////////////////////////////// $query = "SELECT COUNT(*) FROM blogg"; $numblogg = mysql_query($query) or die("Select Failed!"); $numblogg = mysql_fetch_array($numblogg); ?>
echo $numblogg[0]; ?> innlegg er lagt inn i bloggen.
//////////////////////////////// // This is where we decide to get all the entries or just the last 20. // This variable is set by just adding a '?complete=1' after the URL. //////////////////////////////// if ($complete == 1) { $query = "SELECT * FROM blogg ORDER BY blogg_time DESC"; } else { $query = "SELECT * FROM blogg ORDER BY blogg_time DESC LIMIT 20"; } $blogg = 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 ($blogg = mysql_fetch_array($blogg)) { ?>Navn: echo $blogg['blogg_name']; ?> | Epost: echo $blogg['blogg_email']; ?> | //////////////////////////////// // The database has a timestamp record type that we can use to show the // date the guestbook was filled out. //////////////////////////////// $datefromdb = $blogg['blogg_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)); ?> Dato: echo $orgdate; ?> |
echo $blogg['blogg_message']; ?> |
} ?>
Innlegg oversikt:
Kommer etter hvert...