mysql - PHP Queries in Play Framework 1.3.x -
i'd know if can use php in order data mysql database. fraction of code can seen here:
<?php $servername = "localhost"; $username = "root"; $password = "pass"; $dbname = "name"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select aa, bb, cc data"; $result = $conn->query($sql); ... ?> this placed inside html file in play framework folder "views", , loaded controller, when loads, shows me code if text, , not code or action supposed do, not recognise it. how can solve it?
no, cannot use php inside templates, play doesn't parse php @ all, doesn't know there php.
p.s. trying reuse php code in java app more difficult learning valid approach java only, see answer similar post (it's mysql raw access, not php integration) can reuse in several minutes: https://stackoverflow.com/a/31118795/1066240
as bjfletcher mentioned need configure both runtimes able work java , php @ 1 server it not allow using php in play's templates anyway! doesn't make deeper sense.
Comments
Post a Comment