Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php array

Status
Not open for further replies.

smartglass

IS-IT--Management
Mar 14, 2006
33
GB
Hi:
I am trying to create a drop down list using a 'SELECT DISTINCT' from a table to give me available customers; and then pass the selected customer to a second page that allows me to view the details (address, phone, etc) of that customer.
Am I right in thinking with the second page carrying a 'SELECT * FROM customer WHERE NUMBER = $....' with the array posted after the $?
If I try this I get a blank return . Overwrite the array with a fixed value gives me the results expected.
Could somebody please advise me of how to pass the array across to the new page, and incorporate it in my SELECT statement? I must be doing something basically wrong!
 
Why would you be passing an array around?

First, make sure that every record in your customer database can be uniquely identified. I recommend an auto_increment index in the table.

As I see it, you have two scripts, call them list.php and contact.php.

When you run list.php, it provides a list of customers, each record being a hyperlink. Each hyperlink will be of the form:

<a href="contact.php?contactid=[some number]">Customer Name</a>

where "[some number]" is the ID if the record of that customer.

When a user clicks on the link, contact.php uses $_GET['contactid'] in an SQL query to fetch the record for that user.

No arrays need be used or passed.


Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top