Jump to content

Recommended Posts

Posted (edited)

Just wondering if someone can help here.

 

I have a PHP script with an SQL query. The MySQL query picks up data from one table called

'info'. It has the following fields (as I am just testing at the moment)

 

[iD | UserID | Email | Phone]

 

I have another table in the mysql database called 'users'. This has

 

[iD | UserID | Surname | Forename]

 

The UserID is the same. When a 'user' submits their 'info', it submits their info into the info database.

 

I am wanting to display results from 'info' in order of 'surname' by using the "UserID".

So that would use the UserID to cross reference to find the users username and display the phone numbers and email addresses in order of surname.

(because part of the PHP script already has a function to display the username in the table of info by picking up the forename, surname based on the userID).

 

Does anyone know the correct MySQL statement I would use to achieve this?

I seem to remember doing it before but can't get it to work anymore the way I thought was possible.

 

Many thanks,

Mike

Edited by Silvor

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...