Jump to content
xisto Community
vblk

A Really Big Problem In Php Codin Please help me im a starter

Recommended Posts

Dear Anybody, I'm going to start a website (on Xisto) which will give away free VB source code. Now i hav got a list of all the Projects and have written them all on the web. But i want a visitor to be able to click on a certain heading ofa project and then he/she will be taken to a automated page giving all the projects description and letting him/her download it. Now the problem is that i WILL NOT BE ABLE to type a whole page for each and every project i'm going to give out. I know that comercial websites use asp or php to automatically make the same page display different info according to the heading earilier clicked. Mind you i have made a mysql database on all the projects. I anyone actually understands what i mean please reply or point me in the right direction.Thank You,VBLK :):rolleyes:

Share this post


Link to post
Share on other sites

You want to do that?
Okay, try this, when you build your page leave sections open for content, So if you plan on having three pieces of informaiton say file name, file size, and description then build the html page as such, but rather then filling in that informaitn echo php variables as such $name, $size, and #desc in the respective spots.

No near the top of your page use the code:

<?phpif (isset($_GET['id'])){//this checks to see if you have specified a page/*now I don't know how to assecc a database but basiacly in your database have a coloum that is called id, now here's where you search for a row which contains the value in the id coloum that is = to $_GET['id'].this is the value of a sent variable*/};else {echo "I'm sorry no file was specified";}?>
now it's as simple as telling your page to take the values from the database and present them in the proper variables. To make a link to the right page link to thispagesname.php?id=the_page_number.
If my code gives syntax errors I'm sorry didn't have time to check it.

Share this post


Link to post
Share on other sites

I know the basic idea was posted before but maybe I could help a bit more.

<?php//check to see if they are trying to view a certain projectif (isset($_GET["id"])) {	$id = $_GET["id"];	// Connect to the mysql and select the database	mysql_connect ( "HOST" , "USERNAME" , "PASSWORD" );	mysql_select_db( "DATABASE" );	// Get the data from the database	$a = mysql_query ( "SELECT * from `PROJECTS` WHERE `id`='".$id."'");	// Put the info into an array for easy use	$info = mysql_fetch_array($a);}else {   // Some other code to list the projects}?>

Basically the only thing I expanded on is actually connecting to the database and pulling the information into an array.

First off, replace HOST, USERNAME, PASSWORD, DATABASE with the correct info. Also replace PROJECTS with the table that the projects are in. I do not know what the host, your username, pasword, database, or the table they are in.

To use the array the information is in, simply type $info["whatever"].

Lets say you wanted to get the name, description, and the link to download the project. Use $info["name"], $info["description"], and $info["link"]. Of course the fields might be different depending on what you named each of the fields in your table.

If you need any more help. I'll be more than happy to help.
Edited by Yarrgh (see edit history)

Share this post


Link to post
Share on other sites

Dear Anybody,

I'm going to start a website (on Xisto) which will give away free VB source code. Now i hav got a list of all the Projects and have written them all on the web. But i want a visitor to be able to click on a certain heading ofa project and then he/she will be taken to a automated page giving all the projects description and letting him/her download it. Now the problem is that i WILL NOT BE ABLE to type a whole page for each and every project i'm going to give out. I know that comercial websites use asp or php to automatically make the same page display different info according to the heading earilier clicked. Mind you i have made a mysql database on all the projects.

 

I anyone actually understands what i mean please reply or point me in the right direction.


Notice from KuBi:
Posting the same thing 18 times is..er..not needed. If this is an official test you should've stated so. Please PM me with an explanation. Warning Issued.

 

Notice from cmatcmextra:
This post is an exact copy of the first! Quoted.

Edited by cmatcmextra (see edit history)

Share this post


Link to post
Share on other sites

Hey Thanks Ejay, Yarrgh and Mold Boy. You guys really helped me alot and i learned alot. By the way (NO Ofence Intended :) ) whats that last message telling about posting the same thing 18 times and who did that guy warn? I know i didn't get any! :rolleyes::D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.