PHP
  Home arrow PHP arrow Page 9 - PHP 101 (part 4) - Look, Ma...It's Ali...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

PHP 101 (part 4) - Look, Ma...It's Alive!
By: Vikram Vaswani and Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 4
    2000-09-01

    Table of Contents:
  • PHP 101 (part 4) - Look, Ma...It's Alive!
  • Dumped!
  • Hello Database!
  • Different Strokes...
  • ...For Different Folks
  • What's In A Name?
  • New Friends
  • Today's Special
  • Nuking The People
  • Oops!

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    PHP 101 (part 4) - Look, Ma...It's Alive! - Nuking The People


    (Page 9 of 10 )

    Finally, now that you've added a million users, it's time to do a little routine maintenance. This example demonstrates how to use the DELETE statement to wipe out a user and his list of sites. Again, the basic principles remain the same, with only the query string changing.


    <?php // has the form been submitted? if($submit) { // connect to the database $conn = mysql_connect("localhost", "test", "test"); mysql_select_db("php101",$conn); $result = mysql_query("select title1,url1,title2,url2,title3,url3 from url_list where uid = '$username'",$conn); // check username $num_rows = mysql_num_rows($result); // if no rows are returned, the username is invalid. if(!$num_rows) { ?> <html> <head> <basefont face=Arial> </head> <body> <center> <font size="3">User not found</font><br> <a href="nuke.php4">Click here to try again</a> </center> </body> </html> <?php } else { // if username is valid, delete the bookmarks. $result = mysql_query("delete from url_list where uid = '$username'",$conn); ?> <html> <head> <basefont face=Arial> </head> <body> <center> <h3>Success!</h3> <?echo $username; ?>'s book marks have been deleted! </center> </body> </html> <?php } } else { // if form has not been submitted ?> <html> <body> <form action="nuke.php4" method="POST"> <table> <tr> <td> Username </td> <td> <input type="text" name="username" length=10 maxlength="30"> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="submit" value="Delete Bookmarks"> </td> </tr> </table> </form> </body> </html> <? } ?>

    More PHP Articles
    More By Vikram Vaswani and Harish Kamath, (c) Melonfire


     

       

    PHP ARTICLES

    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview
    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway