Page 1 of 1

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

Posted: Fri Nov 23, 2007 11:06 am
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?

Posted: Fri Nov 23, 2007 12:04 pm
by John Cartwright
table.. as in.. database table? html table? coffee table?

Posted: Fri Nov 23, 2007 12:39 pm
by Monotoko
lol, i wasnt being very specific was i, its a database table

Posted: Fri Nov 23, 2007 1:13 pm
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']);

Posted: Fri Nov 23, 2007 3:08 pm
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.