Sort of OT: mysql and select from two tables...?

Bob Sneidar bobs at twft.com
Wed Mar 16 16:25:45 EDT 2011


hmmm... maybe "SELECT current_user()"

Bob


On Mar 16, 2011, at 12:15 PM, John Patten wrote:

> Hi All...
> 
> Thanks for the previous help on the on-rev php/mysql question. I have a question about the mysql select command, session_register, and selecting from two tables.
> 
> I have one database with two tables. The tables are teacher_user and student_user.
> 
> Each table has a unique teacher-id stored in a fields. So students with the teacher_id value of 0001 stored in their student_user record all belong to the same teacher.
> 
> 
> Teacher_table        Student_table
> 
> id - 0001                     teacher_id = 0001
> first                               first
> last                               last
> title                               grade
> 
> 
> I also have the teacher login with their username and password comparing what is stored in their db record for username and password. If they match, then their username and password is then session_register("username"); & session_register("password");  .
> 
> What i would like to be able to do is query the database and return a list of students to the individual teacher based on some unique information about the teacher's record, say their username.
> 
> is there some way I can get at the session_register("username") and use it in my select query?
> 
> Something like:
> 
> select "username" from teacher_table and put "id" of table teacher_table into tTeacher_id then
> select tTeacher_id from student_table and loop through the student printing each record
> 
> I suppose if the teacher new their id value I could just have them type that into a form and do a simple query the student_table and teacher_id field by that id value. But I was trying to make it a little more automatic and did not want teachers trying to guess other teachers' ids.
> 
> Thanks in advance!
> 
> John Patten
> SUSD
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list