0

I am in the process of making a chat app. I create accounts, login, select, view and do more already with PHP MySQL. And I am beginning to get into the Instant Messaging side of things.

I am using NodeJS and SocketIO for this and I have got the demo and such running but when attempting to integrate it into my current PHP stack it fails the mysql calls. I believe the problem is the networking but I could be wrong. Some direction or advice would be much appreciated.

User hits index.html > authenticate.js(ajax) > Sessions.php > Redirect to login or load page with data. However the echo data back:

echo "<script type='text/javascript'>
            $('#detailsnote').hide();
            $('#edituserimage').attr('src','$Image');
            $('#editusername').val('$Username');
            $('#editfirstname').val('$Firstname');
            $('#editlastname').val('$Lastname');
            $('#editnickname').val('$Nickname');
            $('#editposition').val('$Position');
            $('#editmobile').val('$Mobile');
            $('#editdob').val('$DOB');
            $('#editemail').val('$Email');
            $('#userid').val('$UserID');
          </script>";

Gets put in a div that handles that data, but instead, it is showing that echo as text.

I could be entirely wrong and can't mix PHP and NODEJS with MYSQL but I thought it would work. So again, any advice is welcome. Even if it is "Re-write the whole thing in NodeJS"

2 Answers 2

2

You can't combine php code with node JS code. Node does not understand the echo keyboard.

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

Comments

2

you have to use the redis for this. And use redis pub/sub method for it. Like make a channel in redis and publish data through php and subscribe(broadcast) redis data via nodejs and send capture it on browser through (socket.io)

2 Comments

Redis is very interesting, thank you for your input Charanjeet, I will do some research into this technology as well.
you can message me any time if you get any enquery

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.