3
I have an HTML interface that should render the query results in the database (PHP+PDO(MYSQL)) how do I inject the results dynamically into the HTML (pure) screen? as queries vary from user to user (one can consult "Tennis" another "dog").
The system works by following the flow: the user accesses an HTML page index where it inserts the query, the query is sent to a file .php
that processes the query and returns the results, for an HTML (pure) page that will render the results of the query, it will have the following appearance:
In red: This the div
that will encompass the results of the consultations (which can be varied in quantity).
In green: this the image to be returned from the database (its address will be returned and inserted in an img tag).
In blue: the name of the product.
The HTML of the image is as follows:
<div class="row">
<div id="conteudo" class="col-md-12 span7 text-center"><!-- START Video Content -->
<div class="video_block">
<a href="#" class="thumbnail">
<img src="../../images/temp/1.jpg" alt="produto"/>
</a>
<div class="caption">
<span class="video_title">Titulo</span>
<br />
</div>
</div>
</div>
</div>
You’ll need to use code
PHP
to enter the data intoHTML
, not to use variablesPHP
, do withJS
. Pass thePHP
forJS
andJS
to theHTML
.– MeuChapeu
@Meuchapeu, forgive my lack of knowledge but did not understand how your solution would work, but thank you very much for your attention in responding
– Ricardo
You take the variables
PHP
usingJavaScript
and passes to theHTML
. So yoursHTML
gets out of codePHP
. How is the code that returns the data? Add it to your question.– MeuChapeu
I didn’t realize what you mean by pure HTML. No JS? No PHP?
– Jorge B.
Pure HTML means not the PHP code inside it
– Ricardo
So the solution is to use Javascript itself. As @Meuchapeu said.
– Jorge B.
could give an example?
– Ricardo