Gee Posted April 11, 2016 Share Posted April 11, 2016 I'm newbie at phaser and I need to connect database to my game. My game menu is created with format html and php, and my game is created with phaser. I need to passing an id which user choose from menu to game with this code : <a class = "btn_song" href = "GamePlay.php?id=<?=$row['id']?>"> And in my game, I've written php code like this : <?PHP $id = $_GET['id']; $query = "select * from song where no = ".$id; ?> but it's wrong. I think it's because phaser didn't support php. I've read that I should use JSON or AJAX, but I still can solve it. How to solve this? WombatTurkey 1 Link to comment Share on other sites More sharing options...
mattstyles Posted April 11, 2016 Share Posted April 11, 2016 Phaser is a front-end technology, as such, it wont kill php, if you were intent on working that way. You're confusing how php generates pages and how you supply data to the client. Take Phaser out of the equation and try to get your code to work in a page with nothing else in it. I think you are confusing where PHP (and possibly also where JS) runs. I wouldnt even worry about the Phaser bit for now, you need to do a bit of research on how PHP builds HTML and how it can be used to supply data from a data source. WombatTurkey and drhayes 2 Link to comment Share on other sites More sharing options...
WombatTurkey Posted April 12, 2016 Share Posted April 12, 2016 Saving this thread Link to comment Share on other sites More sharing options...
Recommended Posts