Jump to content
Fórum Script Brasil
  • 0

Paginação PHP O.O + Mysql


eduehi
 Share

Question

Galera eu to criando um portal de noticias, onde vou fazer o upload por um formulário, e o mesmo tem que jogar a imagem pra uma pasta, e salvar o caminho no banco de dados.

<?php

class Home {

    public function run() {

        $html_home = new Html();
        $html = $html_home->load('view/home.html');

        $tcomunicados = '';
        $taniver = '';

        $tdados = Connection::select("select * from comunicados limit 3");
        foreach ($tdados as $reg) {
            $tcomunicados .= '<TR>
		<TD ROWSPAN=9 HEIGHT="auto" STYLE="border-top: 1px solid #f1f1f1;" class="text-center"><img src="' . $reg['imagem'] . '" width="150"></img></TD>
		<TD COLSPAN=5 VALIGN=MIDDLE STYLE="border-top: 1px solid #f1f1f1; border-bottom: 1px solid #f1f1f1;">' . $reg['titulo'] . '</TD>
                </TR>
             <TR>
		<TD COLSPAN=2><small><cite>' . $reg['por'] . '</cite></small></TD>
		<TD><BR></TD>
		<TD COLSPAN=2><em><small class="subheader">' . $reg['data'] . '</small></em></TD>
             </TR>
             <TR>
                <TD COLSPAN=5 ROWSPAN=6>' . $reg['comunicado'] . '</TD>
                </TR><TR></TR><TR></TR><TR></TR><TR></TR><TR></TR><TR>
                <TD></TD>
                <TD></TD><TD><br></TD>
                <TD></TD>
                <TD></TD>
	</TR>';
        }

        $tdados2 = Connection::select("SELECT * FROM aniversarios");
        foreach ($tdados2 as $reg) {
            $taniver .= '<TR>
		<td BGCOLOR="#FFD700" STYLE="border-bottom: 1px solid #f1f1f1" HEIGHT="15" ALIGN="LEFT"><span><font size=2 color="#006400" ><b>' . $reg['data'] . '</span> - 
		<span><font size=2 color="#006400">' . $reg['nome'] . '</span>, 
		<span><font size=2 color="#006400">' . $reg['funcao'] . '</span> - 
		<span><font size=2 color="#006400">' . $reg['filial'] . '</span></td>

                </TR><TR>
	</TR>';
        }
        $html = str_replace('#TCOMUNICADOS#', $tcomunicados, $html);
        $html = str_replace('#TANIVER#', $taniver, $html);

        return $html;
    }

}

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...