Tips for common tasks in PHP

Tips for common tasks

Now know the basics. Where you go from here is up to you. You know enough now to implement some of these useful tasks:

User database to Tips for common tasks
You could implement a user database. You can add a login feature to this.

• News to Tips for common tasks
You could code a section that always displays the latest news or maybe a “What’s new” section that’s automatically generated. The TABLE could be something like:

Create Table For common tasks

(  id INT NOT NULL AUTO_INCREMENT,  title VARCHAR(40),  newsbody TEXT,  news_date DATE,  PRIMARY KEY (id),  UNIQUE id (id)  );

And assuming you want to automatically show the title of the latest five news items, the code could be something like to Tips for common tasks:

<HTML>  <?php  $sql="SELECT * FROM news ORDER by news_date DESC";  $db = mysql_connect("localhost", "root", "");  mysql_select_db("newsdb",$db);  $result = mysql_query($sql,$db);  echo "Latest News:<br>";  $i=1;  while ($myrow = mysql_fetch_array($result))  {  echo "<a href=\"newsdetail.php?id=".$myrow["id"]."\">".$myrow["title"]."</a><br>";  $i=$i+1;  if($i>5)  break;  }  ?>  </HTML>

• Product database for Tips for common tasks
You could create a detailed database of your products. Clients could see all the products or search for particular product.

andcombd