How can I put data from a php file in html. Here is an example of the html file

<!DOCTYPE html> <html> <body> <div id="demo"></div> </body> </html> 

Php file example

 <? include('db.php'); //Подключение к бд $Sql= "SELECT * FROM `table` WHERE `column1` = 1 $Sql= $PDOdb->prepare($Sql); $Sql->execute(); //Запрос while ($data= $Sql->fetch()) { print('<div>'); print($data['column2']); .... print('</div>'); } ?> 
  • It does not work out. Usually the opposite happens. HTML is put in a PHP file. Tell me why you need it this way, maybe there is some other solution. - dmitryshishkin
  • Make a request to the php file, take the data, put the data into the necessary blocks using jquery - EatMyDust
  • I need this to upload an html file to a third-party service, php files are not loaded there. and for each line not to write a separate html file I want to make a handler that will return to the php file and take data from there - user209681
  • Then just use AJAX, for example. - Aim X
  • And it is possible through <iframe> - lampa

0