Free php scripts


Article Submission
  • Register
  • Login


  • Tutorials/support/References
  • PHP/ASP/PERL Bookstore
  • Community
  • Chat
  • Tutorials
  • Free Smiley Icons
  • Web Hosting

  • Search


    Scripts
  • Chipmunk CMS
  • Forums PHP Script
  • Chipmunk Blogger Script
  • Chipmunk Topsites
  • Chipmunk Addresshost
  • Chipmunk Newsletter
  • Free Guestbook Script
  • Free Poll Script
  • Directory Script
  • Kill Monster
  • Free FFAL script
  • CMS core
  • Chat Room
  • Riddles
  • Random Links
  • Recommend Site
  • Random Quote
  • Story Lines
  • Text Counter
  • Chipmunk Live
  • Chipmunk Bloghost
  • PHP AWS script
  • pwngame
  • Books
  • Begginning PHP4
  • Professional PHP4
  • PHP Cookbook
  • Legal Stuff for scripts
  • Script Liscense


  • Top 5 hottest members
    Chipmunk




    Quality Freelancing


    Sister Sites
  • My Blog
  • Albino Freebies
  • Java gaming
  • Flashninjaclan


  • Premium Affiliates
     
     
    Dynamic URLs tutorial
    To create dynamic URL with php and mysql is quite simple and this small tutorial will teach you how very easily. If you look at Chipmunk directory, board, or CMScore, you will find that they all use Dynamic URLs with PHP/Mysql. This following code snipplet will show you everything, for this code, you must assume that you have following mysql table:

    Table name: thetable
  • Field I should be a field called ID with the properties bigint, length 21, primary and auto increment.

  • Field II should be a field called message with the properties longtext, length 6000

  • Field III should be a field called name with properties varchar and length of 256

    I'm also assuming the filename you write this code on is called "index.php".

    Now supposed you have some entries. Observe the following code:

    < ?
    if (isset($ID)) //this is looking at a specific ID
      {
         $S="SELECT* from thetable where Entry where ID='$ID'";
        //$ID is the number after the ID= in your browser
        $S2=mysql_query($S1);
          $S3=mysql_fetch-array($S2);
        print "$S3[longtext]";
        //prints the text or entries of the field with the set ID
      }

    else if(!isset($ID)) // else looking at root
      {
         $d="SELECT * from thetable"; //select all the entries in the table
         $d2=mysql_query($d);
          while($d3=mysql_fetch_array($d2))
          //this goes through all the entries that you selected
         {
            print "<A href='index.php?ID=$d3[id]'>$d3[name]</a>
    ";      }
      }
    ?>



    In the code above, the comment relates to the line or the code on the line or the line of code above it. Basically the first if case says that if an ID is set then you select all the entries from the sql where the ID field is equal to the ID set in the browser, since ID is auto-incrmenting and each ID is unique(provided that you have less than 100 quadrillion entries in the table), that means it selects the one entry your looking for, then it queries it and then puts it into an array form, since there is only one possible entry, its okay to set the variable $S3 to the array of the query. the print "$S3[longtext]" simply prints the textfield of the entry associated with whose ID is set by the number following the ID= in the browser.

    Now lets look at the second case which is simply if there is not ID set in the browser. When there is no ID value set in the browser URL, it simply select every single entry in the table and then the while look goes through all the entries possible. The print statement prints a hyperlink URL index?ID=$d3[ID] every time the loop goes through, which in this case is from the first entry in the SQL table until it runs out of entries. This, combined with the previous IF case effectively prints out links to every entry ID in the SQL table. When any of the links is clicked on ID is now set and the links still leads to index.php but it now an ID number is set, and you see the message associated with that ID.

    Thats all there is to dynamic URLS!! For a better understanding of how dynamic URL's work, I suggest you look at the code for index.php in my CMS core script, going through that script will give you a true understanding of how dynamic URLs are generated.

    It you have questions, Please post them in the Support Forums

  • News Categories
  • Site News
  • Technology news
  • Programming news
  • Other Major News


  • Search Articles


    Make Money
    Free Blog promotion -- Get your blog syndicated on thousands of other blogs for free.

    Tutorial Categories
    Ad Managers(5)
    Calendars(6)
    Chat systems(5)
    CMS systems(7)
    Cookies/Sessions(4)
    Counters(8)
    E-commerce(7)
    File Manipulation(4)
    Forms(10)
    Forums(4)
    Guestbooks(5)
    HTML/CSS Tutorials(12)
    Image-related(5)
    Link indexing/ Classifieds(6)
    Mailing Lists/E-mail(5)
    Misc(17)
    MySQL Related(9)
    Navigation/Templating(6)
    PHP Basics(10)
    Polls(3)
    RSS and other feeds(5)
    Searching(4)
    Security(13)
    XML and other parsing(3)


    Resources
    Scripts/Graphics
  • Ecommerce Website Design
  • Hotscripts
  • Boxedart
  • Zero Web
  • Edorel Free Hosting
  • Javascript Reference
  • Powerful Scripts
  • Scripts Bank
  • Finestzone Designs
  • Layouts 4 free
  • Website Resources
  • 4 templates
  • Free URL redirection
  • Web Hosting
  • Website Hosting
  • Photoshop Tutorials
  • PHP and MYSQL tutorials
  • Free Templates
  • Tutorials DB
  • Pure Graphics
  • Total Tutorials
  • Myspace Pro Designs
  • Texas Electric Service
  • Cirro Energy
  • Reliant Energy Houston


  • Random Affiliates
        
        
        

    More affiliates