session_register is not a mySQL function, it is php. It is also deprecated, so it may or may not work depending on the version of php being used.
I thought you were trying to get Livecode to tell you who the current logged in user was? current_user() or just user() works for me. Bob on mouseUp pMouseBtnNo put "select current_user()" into theSQL put dbconn_get("connection id", "priconn", "primary") into thePriID -- sqlYoga function try put revDataFromQuery(comma, return, thePriID, theSQL) into theSQLData -- RevDB function catch theError answer theError exit to top end try put theSQLData end mouseUp This returns my on-rev user login@the ip I am connecting from as in mydatabase_mylogin@69.227.63.5 (I made that up). Wouldn't that do it for you? Or are you using some kind of internal authentication and you are trying to get what the user typed into a form? Bob On Mar 16, 2011, at 4:10 PM, John Patten wrote: > Hi Bob... > > session_user() appears to give me something other than the current logged in > user. It returns: myaccount_nameofdatabase > > This is what I did to test it out: > > $result = mysql_query( "SELECT session_user() FROM teacher_user" ) > or die("SELECT Error: ".mysql_error()); > > $num_rows = mysql_num_rows($result); > > print "There are $num_rows records.<P>"; > > print "<table width=600 border=1>\n"; > while ($get_info = mysql_fetch_row($result)){ > print "<tr>\n"; > foreach ($get_info as $field) > print "\t<td>$field</td>\n"; > print "</tr>\n"; > } > print "</table>\n"; > > > I think even if I could return just the current user's profile (fields in > their record) using the session_register command in mySQL I'd be making > progress :-) > > Any other ideas? > > Thank you! > > John Patten > SUSD > > On Mar 16, 2011, at 1:24 PM, Bob Sneidar wrote: > >> You can use "SELECT session_user()" to get the currently logged in user. >> It's a synonym for "USER()". That help? >> >> 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@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-livecode >> >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode