1

I am working on a project in php and node.js. I have some data in session like

[user]= ARRAY([0]=> stdClass Object([username] => XXX, [app_id] -> XXX))

Now i want to read app_id from session and need to use in node.js like

var myquery =
            "SELECT count(cs.id ) AS new_message " + 
            "FROM dcms_corr_status as cs " +
            "LEFT JOIN `dcms_user` as u ON `u`.`appointment_ref_no` = `cs`.`appointment_ref_no` "+
            "WHERE `cs`.`appointment_ref_no` = '" + user_app +"' AND `cs`.`isread` = 0 " +
            "AND `cs`.`action_or_info` = 1";
var query = connection.query(myquery),

where user_app is my session data.

How can i do that?

3
  • 4
    You'll need to use an external database/cache for a session store, such as Redis or Memcached. Get PHP to store the session data and retrieve it with Node. Commented May 15, 2014 at 10:47
  • 1
    May also want to encode it to JSON so node can better understand it. Commented May 15, 2014 at 10:48
  • This solution may help you: stackoverflow.com/a/51754896/1274820 Commented Aug 31, 2018 at 22:41

1 Answer 1

2

If you really want to parse a PHP session file in node you could try groan. Otherwise you might look into using MySQL, memcached, or Redis for your session storage instead.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.