I am working on a project with php/mysql. I have 2 tables with the following columns:
------------------
table projects:
projectid,summary,details,author
table users:
userid,email,password,first,last
------------------
When a project is submitted into the projects table the author field references their uid from the users table.
When doing a query for projects the uid of the author is returned. What is the most efficent way to swap out the uid with the person's first and last name from users? Right now I have a getuidname($id) function that queries for id and returns the name, but that runs a query EACH time.
My projects query is simple:
mysql_query("SELECT * FROM projects WHERE author = '$_SESSON[uid]'"
Is there a way to select from the other table at the same time and get all the data in 1 shot? or maybe an array of uid's and name's?
Any advice would be great!
Thank you,
Eric Eberhardt
Eric
------------------
table projects:
projectid,summary,details,author
table users:
userid,email,password,first,last
------------------
When a project is submitted into the projects table the author field references their uid from the users table.
When doing a query for projects the uid of the author is returned. What is the most efficent way to swap out the uid with the person's first and last name from users? Right now I have a getuidname($id) function that queries for id and returns the name, but that runs a query EACH time.
My projects query is simple:
mysql_query("SELECT * FROM projects WHERE author = '$_SESSON[uid]'"
Is there a way to select from the other table at the same time and get all the data in 1 shot? or maybe an array of uid's and name's?
Any advice would be great!
Thank you,
Eric Eberhardt
Eric