![]() ![]() ![]() These could easily be converted to an "exec a PHP script to talk to MySQL" or the other way around. I started using this "exec a PHP script to talk to MySQL" a bit later in the process of building this app, so there are still a few Javascript function (mysql query) nodes in the flow. If you don't have a big LAMP application running already, this method may not be appropriate. However, we already have a ton of operational PHP code, so it "fits" our LAMP backend. This provides me more error checking and more flexibility than doing the MySQL queries directly from Node-RED. When the MySQL DB is on the same server as the Node-RED application (as it is in this case) I prefer to do the DB query and all the "heavy lifting" in PHP. Of course, as all experienced programmers know, there are myriad ways to build a Telegram bot and a trivial game like this in Node-RED so let me tell you why did it this way. Players can also check their score in a similar manner (there are no public leaderboards in this app, unlike the web-based version on the site).If the player answers true or false when all questions have been answered, they are reminded to request another trivia question.When the player responds true or false, their answer is sent to either one of two PHP scripts which processes true or false, updated the DB, formats the reply and returns it to the player.Otherwise, the player is reminded to answer the unanswered question. If there are no unanswered questions for the player, a new question is retrieved and send to the user.Requests for a new trivia question is checked against the DB calling a PHP script, which in turn, does all the MySQL queries to the trivia DB tables. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |