theoretical question

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
spitfire_esquive
Forum Commoner
Posts: 37
Joined: Sun Nov 06, 2005 6:46 am

theoretical question

Post by spitfire_esquive »

hello guys,

i made a simple query log program using msaccess where you can search for the client in the database.

if client is found in database
you are able to enter a query under his name
if not
ask the "admin" to add the client's details.

so basic setup is every client has a unique id in a table (clientdetails) and the query is located in another table (clientquery). in each table there is a field named clientid which is the unique key (in clientdetails)

i am learning/making one in php right now and i just have a question :

*what would happen if the search string i used displayed multiple results? say i did a search using "%mich%", i'm sure a lot of "michaels" and "michel" would pop up. i could put them all in an array and display them in a table. once the user chooses the correct client that he is looking for, how can i make it so that when he clicks on the client's name, a form is opened for him to enter his query (which is attached to the client's clientid).

just a theoretical question, no code needed, i just wanted to learn how it goes in terms of php.

many thanks!
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Each user has a unique ID. When you get the list of users with '%mich%' also get their ID. When you display the list of users, display the user id in the URL for the next page which will then show the correct user:

Code: Select all

<a href="editUser.php?userId=<?php echo $userID;?>">Michael User</a>
spitfire_esquive
Forum Commoner
Posts: 37
Joined: Sun Nov 06, 2005 6:46 am

Post by spitfire_esquive »

hawleyjr wrote:Each user has a unique ID. When you get the list of users with '%mich%' also get their ID. When you display the list of users, display the user id in the URL for the next page which will then show the correct user:

Code: Select all

<a href="editUser.php?userId=<?php echo $userID;?>">Michael User</a>
thank you very much!!! i never thought that you could do that!

i'll try to make it work!

thanks again!!
Post Reply