Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
451 views
in Q2A Core by

I am trying to configure a second q2a site using the first q2a site db of users. But i'm having problems with the function qa_get_logged_in_user() in qa-external-users. After some researching I'm guessing that q2a stores the session ID inside a cookie (qa_key) and so I changed the preview value to qa_key and got this function:

if ($_COOKIE['qa_key']) {

            $qa_db_connection=qa_db_connection();

            $result=mysql_fetch_assoc(

                                      mysql_query(

                                                  "SELECT userid, username, email, admin_flag FROM users WHERE userid=".

                                                  "(SELECT userid FROM sessions WHERE sessionid='".mysql_real_escape_string($_COOKIE['qa_key'], $qa_db_connection)."')",

                                                  $qa_db_connection

                                                  )

                                      );

 

The problem is, I always get following errors:

 

Warning: mysql_real_escape_string() expects parameter 2 to be resource, object given in /home/matemati/public_html/meta/qa-external/qa-external-users.php on line 249

Warning: mysql_query() expects parameter 2 to be resource, object given in /home/matemati/public_html/meta/qa-external/qa-external-users.php on line 251

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in /home/matemati/public_html/meta/qa-external/qa-external-users.php on line 252

 

Any help?

Q2A version: 1.7

Please log in or register to answer this question.

...