Results 1 to 10 of 15
-
5th May 2011, 08:03 PM #1OPMember
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.
ThanksSponge 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
-
5th May 2011, 08:11 PM #2It begins...
From what I can recommend, create a file:
Code:detail.php
Code:detail.php?id=ID
Of course, you're gonna have to sanitize/escape the MySQL arguments, and the standard security procedures, etc.
-
5th May 2011, 08:12 PM #3Respected DeveloperWebsite's:
wrzc.orgPHP 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
-
5th May 2011, 08:14 PM #4OPMember
-
5th May 2011, 08:15 PM #5It begins...
Mr Happy just posted a sample code for you
-
5th May 2011, 08:25 PM #6OPMember
Hey Mr. Happy it tells me this:
Also is there a way i can make the links on the table clickable?
-
5th May 2011, 08:29 PM #7MemberWebsite's:
EastsideHosting.com MediaONAIR.com ImgWiz.com cPadmin.net EastsidePCWorks.com HostedTalk.comPHP 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>";
}
?>
Same way as others, execute it by details.php?id=number_hereEastsideHosting - (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)
-
5th May 2011, 08:29 PM #8Respected DeveloperWebsite's:
wrzc.orgShow 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
-
5th May 2011, 08:42 PM #9OPMember
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>';
}
}
?>
-
5th May 2011, 08:52 PM #10MemberWebsite's:
EastsideHosting.com MediaONAIR.com ImgWiz.com cPadmin.net EastsidePCWorks.com HostedTalk.comHe made a typo;
Find:
PHP Code:$G_GET['id']
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)
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Creating tables in RVSiteBuilder
By Areon in forum Server ManagementReplies: 0Last Post: 3rd Mar 2014, 03:15 PM -
How Should I Organize My SQL Tables?
By Robin Hood in forum Web Development AreaReplies: 7Last Post: 22nd Aug 2012, 03:54 PM -
Exporting tables from one to another [help req]
By xtone in forum Web Development AreaReplies: 6Last Post: 27th Sep 2011, 11:05 PM -
help me mysql tables are corupted
By awaisdik2003 in forum vBulletinReplies: 0Last Post: 21st Sep 2010, 12:38 PM -
IP tables warning..how to fix it
By lucy fox in forum Server ManagementReplies: 2Last Post: 22nd Apr 2010, 11:04 AM
themaPoster - post to forums and...
Version 5.23 released. Open older version (or...