Activity Stream
48,167 MEMBERS
6866 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1.     
    #1
    Member

    Default Help with PHP & Tables

    Hello All,

    I need some small help here.

    At first i have a database:



    Secondly i have a table where all downloads are being called:



    I want a script whereby, if i click on one download, it opens another page and displays in that page, all information of the particular download.

    Meaning as you can see on the table u cant see the download links, just title and description for now. (I will remove the description from the table too)

    SO when someone clicks the download he/she wants they get to the download page, which displays the title, description and download.

    Please assist how i can do this.

    Thanks
    Sponge Bob Reviewed by Sponge Bob on . Help with PHP & Tables Hello All, I need some small help here. At first i have a database: http://i.imgur.com/8Nwpp.png Secondly i have a table where all downloads are being called: Rating: 5


  2.   Sponsored Links

  3.     
    #2
    It begins...
    From what I can recommend, create a file:

    Code: 
    detail.php
    Which accepts a GET based id:
    Code: 
    detail.php?id=ID
    where ID is the post ID in your database. From there on, php can call the relevant post details from the database using the ID supplied in the GET query.

    Of course, you're gonna have to sanitize/escape the MySQL arguments, and the standard security procedures, etc.

  4.     
    #3
    Respected Developer
    Website's:
    wrzc.org
    PHP Code: 
    <?php
    // First check if we have a id of a download to show in detail
    if(isset($G_GET['id']) && is_numeric($_GET['id']) && (strlen($_GET['id'] < 7)) {
        
    $sql mysql_query("SELECT id, title,desc,bla,bla2,etc FROM table WHERE id=".$_GET['id']);
        
    // output your detailed info here. Smart to check if it exists first. Throw a message if it doesn't exist and if it does show the download.
    }
    // if no download number then we'll just show the list as normal
    else
    {
        
    $sql mysql_query("SELECT id, title FROM table LIMIT 30");
        while(
    $row mysql_fetch_assoc($sql))
        {
            echo 
    '<tr><td>'.$row['type'].'</td><td><a href="index.php?id='.$row['id'].'">'.$row['title'].'</a></td></tr>';
        }
    }
    Tutorial How to SEO your Warez Site a guide to help you increase your organic traffic

    Huge list of Warez Sites and free Multiposter Templates

  5.     
    #4
    Member
    Quote Originally Posted by Lifetalk View Post
    From what I can recommend, create a file:

    Code: 
    detail.php
    Which accepts a GET based id:
    Code: 
    detail.php?id=ID
    where ID is the post ID in your database. From there on, php can call the relevant post details from the database using the ID supplied in the GET query.

    Of course, you're gonna have to sanitize/escape the MySQL arguments, and the standard security procedures, etc.
    Ok,

    Is it possible you can provide me with that GET query, so i can add a Download link at the end of the table, thus when clicking it, i can point it to

    /details.php?id=id

    Please assist with the code if possible.

    Thanks


  6.     
    #5
    It begins...
    Mr Happy just posted a sample code for you

  7.     
    #6
    Member
    Hey Mr. Happy it tells me this:




    Also is there a way i can make the links on the table clickable?


  8.     
    #7
    Member
    Website's:
    EastsideHosting.com MediaONAIR.com ImgWiz.com cPadmin.net EastsidePCWorks.com HostedTalk.com
    PHP Code: 
    <?php

    $action 
    $_GET["action"];

    $query  "SELECT * FROM my_table";
    $result mysql_query ($query) or die ("Query failed");
    $data   mysql_fetch_object($result)) {

    $id          $data->id;
    $title       $data->title;
    $description $data->description;
    $date        $data->date;
    $download    $data->download;


    if(
    $action && is_numeric($id)) {
    //tables here
    echo $title;
    echo 
    "<br /><br />";
    echo 
    $description;
    echo 
    "<br /><br />";
    echo 
    "Date: $date";
    echo 
    "<br /><br />";
    echo 
    "<a href=\"$download\">Download</a>";
    }

    ?>
    Basic code, I created.

    Same way as others, execute it by details.php?id=number_here
    EastsideHosting - (Web Hosting, Proxy Hosting, Reseller Program)
    MediaONAIR - (SHOUTcast Servers, ICEcast Servers, Reseller Program)
    Server Administrator - (Dedicated Servers, VPS Management, One Time Services)
    ImgWiz - (Free Image Hosting)

  9.     
    #8
    Respected Developer
    Website's:
    wrzc.org
    Show us your code.

    And the links are clickable. This is the part that makes them clickable
    PHP Code: 
    <a href="index.php?id='.$row['id'].'">'.$row['title'].'</a
    Tutorial How to SEO your Warez Site a guide to help you increase your organic traffic

    Huge list of Warez Sites and free Multiposter Templates

  10.     
    #9
    Member
    Well @Happy, I am now all confused as i dont know what i am doing.

    Can you also give me a good table script where i can add the table, together with the links being clickable.

    Secondly, i added

    <?php
    // First check if we have a id of a download to show in detail
    if(isset($G_GET['id']) && is_numeric($_GET['id']) && (strlen($_GET['id'] < 7)) {
    $sql = mysql_query("SELECT id, title,desc,bla,bla2,etc FROM table WHERE id=".$_GET['id']);
    // output your detailed info here. Smart to check if it exists first. Throw a message if it doesn't exist and if it does show the download.
    }
    // if no download number then we'll just show the list as normal
    else
    {
    $sql = mysql_query("SELECT id, title FROM table LIMIT 30");
    while($row = mysql_fetch_assoc($sql))
    {
    echo '<tr><td>'.$row['type'].'</td><td><a href="index.php?id='.$row['id'].'">'.$row['title'].'</a></td></tr>';
    }
    }
    ?>
    To the details.php and went to /details.php?id=2 but i got this error:



  11.     
    #10
    Member
    Website's:
    EastsideHosting.com MediaONAIR.com ImgWiz.com cPadmin.net EastsidePCWorks.com HostedTalk.com
    He made a typo;

    Find:
    PHP Code: 
    $G_GET['id'
    Change:
    PHP Code: 
    $_GET['id'
    EastsideHosting - (Web Hosting, Proxy Hosting, Reseller Program)
    MediaONAIR - (SHOUTcast Servers, ICEcast Servers, Reseller Program)
    Server Administrator - (Dedicated Servers, VPS Management, One Time Services)
    ImgWiz - (Free Image Hosting)

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating tables in RVSiteBuilder
    By Areon in forum Server Management
    Replies: 0
    Last Post: 3rd Mar 2014, 03:15 PM
  2. How Should I Organize My SQL Tables?
    By Robin Hood in forum Web Development Area
    Replies: 7
    Last Post: 22nd Aug 2012, 03:54 PM
  3. Exporting tables from one to another [help req]
    By xtone in forum Web Development Area
    Replies: 6
    Last Post: 27th Sep 2011, 11:05 PM
  4. help me mysql tables are corupted
    By awaisdik2003 in forum vBulletin
    Replies: 0
    Last Post: 21st Sep 2010, 12:38 PM
  5. IP tables warning..how to fix it
    By lucy fox in forum Server Management
    Replies: 2
    Last Post: 22nd Apr 2010, 11:04 AM

Tags for this Thread

BE SOCIAL