I cant see how i would do this, can anyone help?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Monotoko
Forum Commoner
Posts: 64
Joined: Fri Oct 26, 2007 4:24 pm

I cant see how i would do this, can anyone help?

Post by Monotoko »

alright guys, this is what i want:

I want a system that does the following:

-Checks inside a table, and gets ship names from it, then displays them as results (already got this)

but then i want a user to be able to click any one of the ships and find info on it on the next page which comes from another table (which would be the same for each ship, just display differant results, depending on which ship you click)

how would i go about doing this?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

table.. as in.. database table? html table? coffee table?
Monotoko
Forum Commoner
Posts: 64
Joined: Fri Oct 26, 2007 4:24 pm

Post by Monotoko »

lol, i wasnt being very specific was i, its a database table
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Make all of the URLs contain the primary key value of the ship in the query string for a page to display the ships.

i.e.

Code: Select all

echo '<a href="shipDetails.php?shipId=' . $ship['id'] . '>Details for ' . $ship['name'] . '</a>';
Then, on that page, use the data from the query string

i.e.

Code: Select all

mysql_query('SELECT * FROM `ship_details` WHERE `id` = ' . (int)$_GET['shipId']);
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Yup, superdezign nailed the logic you want to follow. Just make sure before putting this type of code flow into production that you valid, sanitize and filter your data appropriately.
Post Reply