Database Articles

  Home arrow Database Articles arrow Page 16 - Create dynamic sites with PHP & MySQL
DATABASE ARTICLES

Create dynamic sites with PHP & MySQL
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 54
    2002-05-19

    Table of Contents:
  • Create dynamic sites with PHP & MySQL
  • Introduction and installation
  • Installing Apache server routines
  • Installing MySQL
  • Installing PHP
  • Your first script
  • Your first database
  • Where's my view?
  • Creating an HTML form
  • Putting it together
  • Passing variables
  • Viewing individual rows
  • Deleting rows
  • Editing data
  • Searching our data
  • Tips for common tasks

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Create dynamic sites with PHP & MySQL - Tips for common tasks


    (Page 16 of 16 )

    We have covered the basics. Where you go from here is up to you. You know enough now to implement some of these useful tasks: * User database You could implement a user database. You can add a login feature to this. * News 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 news 

    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:

    <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 You could create a detailed database of your products. Clients could see all the products or search for particular product.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.
    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap