I explain why the title was perhaps going to be a bit long and I wanted to simplify it.
I have a page index.php , it has a table, where in a tr
, td
( height
and width
already established) it has a include ('/funciones/cargar_entrada.php')
, so the content of this include will be displayed in this tr
, td
.
The load_entry.php function connects to a DB and retrieves the last entry (Example: entry1.html ). I have tried to show it entrada1.html
by trying with;
- include
echo "< a href='/../entradas/entrada1.html'>< /a>";
<script type="text/javascript"> location.href='/../entradas/entrada1.html'; </script>
So far everything is fine. The thing is that it doesn't show the content of entrada.1html
en cargar_entrada.php
...
Load_input.php code
$server=""; $user=""; $pass=""; $bbdd="";
$connection=mysqli_connect($server,$user,$pass,$bbdd) or die ("Error 505 NOT FOUND");
$sql="SELECT * FROM entries ORDER BY id DESC LIMIT 1"; $table=mysqli_query($connection,$sql);
while ($row=mysqli_fetch_object($table)) { $id=$row->id; }
header('Location:../tickets/ticket'.$id.'.html');
I know it's very basic but it works for me
Edit: In the end I have opted for the following.
In index.php I have created an iframe with src=load_entrada.php, and this with the code that I have put above, loads the last entry correctly.
Problem solved, thanks for the help!
You say that you have tried in three different ways to display the content of a document
html
within a cell (<td></td>
) of a table.Well, your first attempt was using " include ":
Tell you that you are doing the right thing, but you should know that the "include" directive is limited to "include" the content of the file that you indicate. You comment that:
I understand that you mean that you have a file "
cargar_entrada.php
" in which you have a function called "cargar_entrada()
" that makes a query to a DB and retrieves the name of the file in which the codehtml
of the last entry is. Note that you should not only declare and define the function "cargar_entrada()
" like this:If not, you have to call it somewhere or in the upload_entry.php file itself:
or after the include:
enrada1.html
In either of the two ways, the content of the file inside the cell would be displayed correctly .Warnings: * before showing, check the existence of the file
I have assumed many things, I hope I have been right. If I'm right, show us the code for upload_page.php and how you call it inside td.