Tutorial System - What I Need/What I Know
Posted: Sun Jan 22, 2006 11:15 pm
Allright my goal is to make a tutorial system with the following features.
-Add tutorials(80%)
-Delete tutorials(80%)
-Automatically add tutorial names to the list(40%)
-Have a count of how many tutorials there is beside the subject name(5%)
The percentage beside them is how sure I am that I CAN do the tast.
Details - I know how to add information and display it on a single page, Well I would like to create some sort of code so when I add tutorials to the database I can display it by a link, Somthing like this "www.test.com/tutorials?php=1" I want it so this will show the tutorial on the page with my template.
This is the code im working with so far.
-Add tutorials(80%)
-Delete tutorials(80%)
-Automatically add tutorial names to the list(40%)
-Have a count of how many tutorials there is beside the subject name(5%)
The percentage beside them is how sure I am that I CAN do the tast.
Details - I know how to add information and display it on a single page, Well I would like to create some sort of code so when I add tutorials to the database I can display it by a link, Somthing like this "www.test.com/tutorials?php=1" I want it so this will show the tutorial on the page with my template.
This is the code im working with so far.
Code: Select all
<?php
// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// create query
$query = "SELECT * FROM phptuts ORDER BY `id` DESC";
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
// see if any rows were returned
if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
while($row = mysql_fetch_assoc($result)) {
echo "<b>Tutorial By : </b>"."<b>".$row['name']."</b><br>";
echo "<b>Date : </b><b>".$row['date']."</b><br><br>";
echo $row['content']."<br><br>";
}
}
else {
echo "No rows found!";
}
// free result set memory
mysql_free_result($result);
// close connection
mysql_close($connection);
?>