Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
blood

Escrever Dados Da Tabela...

Question

Tenho uma idéia, mas uma dúvida...Como faço para escrever os dados da tabela do mysql? Eu fiz uma tabela com os campos >> id, hora, data, url, nota, por,download, cliques, comentario(é de downloads). Como faço para exibi-los em uma tabela... ex.: (não sei como é mas é uma idéia).

Número: <? echo $id; ?> - Download: <? echo $download; ?>

Comentário: <? echo $comentario; ?>

<a href="downloads/redir.php?url=<? echo $url; ?>">clique aqui para baixar</a>

Nota: <? echo nota; ?>

mas assim não dá...

Tah tpw... é isso, mas colocaria mais campos, cliques, adicionado por, data, hora... Assim eu adicionaria os downloads pelo phpmyadmin, e elas eram incluídas direto....

como faço isso no mysql?? vlwz... e fuizz...

Edited by blood

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0
<? $SQL  = mysql_query("SELECT * FROM tabela");

WHILE ($i = mysql_fetch_row($SQL)) { ?>

Número: <?=$i[0]?> - Download: <?=$i[1]?>

Comentário: <?=$i[2]?>

<a href="downloads/redir.php?url=<?=$i[3]?> ">clique aqui para baixar</a>

Nota: <?=$i[4]?>

<?}?>

Share this post


Link to post
Share on other sites
  • 0

Algumas dúvidas >> Isso seria pelos números dos campos(ou sei lá como se fala)? teria q ser uma ordem? download - 1 url - 2 assim?

>> Não precisa fazer a conexão?

>> e lá onde tá escrito tabela é pra colocar o nome da tabela??? o nome é downloads...

vlwss e fuiss ;)

Share this post


Link to post
Share on other sites
  • 0

Eu fiz lá e fui testar... e deu esses erro >>

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\phpdev\www\fd\programas.php on line 31

q aconteceu? vo pasa como fikow

<table width="450" height="42" border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" style="border-collapse: collapse; border-style: solid; border-width: 0; ">
  <tr>
    <td height="21" colspan="3" style="border-style: solid; border-width: 1; background-color: #03567E" width="448"><strong>&nbsp;&nbsp;<font color="#FFFFFF">Programas &raquo;</font></strong></td>
  </tr>
  <tr>
    <td height="21" colspan="3"><?
$conn = mysql_connect("localhost","root","");            
$SQL  = mysql_query("SELECT * FROM downloads");   

[B]while($i = mysql_fetch_row($SQL)){ ?>//linha 31[/B]
      <table width="450" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid; border-width: 0; " bordercolor="#111111" height="316">
        <tr class="style3">
          <td height="19" colspan="3">&nbsp;</td>
        </tr>
        <tr valign="middle" class="style3">
          <td width="186" height="14" style="border-style: solid; border-width: 1">&nbsp; Download &raquo;</td>
          <td height="14" colspan="2" style="border-style: solid; border-width: 1"><span class="style10">
            <?=$i[2]?>
          </span> </td>
        </tr>
        <tr valign="middle" class="style3">
          <td width="186" height="14" style="border-style: solid; border-width: 1"><span class="style10"><strong>&nbsp; id &raquo;</strong></span></td>
          <td height="14" colspan="2" style="border-style: solid; border-width: 1"><span class="style10">
            <?=$i[1]?>
          </span></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="79" rowspan="3" width="186" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10"><strong>&nbsp; Tempo Estimado &raquo;</strong></span></td>
          <td width="93" height="19" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10"><strong>Discada</strong> <strong>&raquo;</strong></span></td>
          <td width="171" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000" height="19"><span class="style10">
            <?=$i[3]?>
          </span> </td>
        </tr>
        <tr>
          <td width="93" height="19" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10"><strong>Cabo</strong> <strong>&raquo;</strong></span></td>
          <td width="171" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000" height="19"><span class="style10">
            <?=$i[4]?>
          </span></td>
        </tr>
        <tr>
          <td width="93" height="19" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10"><strong>ADSL</strong> <strong>&raquo;</strong></span></td>
          <td width="171" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000" height="19"><span class="style10">
            <?=$i[5]?>
          </span></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="19" width="186" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10"><strong>&nbsp; Adicionado em <strong> &raquo;</strong></strong></span></td>
          <td height="19" colspan="2" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10">
            <?=$i[6]?>
          </span></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="19" width="186" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10"><strong>&nbsp; Nota <strong> &raquo;</strong></strong></span></td>
          <td height="19" colspan="2" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10">
            <?=$i[7]?>
          </span></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="23" width="186" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10"><strong>&nbsp; Licen&ccedil;a <strong>de Uso &raquo;</strong></strong></span></td>
          <td height="23" colspan="2" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10">
            <?=$i[8]?>
          </span></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="19" width="186" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10"><strong>&nbsp; Plataforma &raquo;</strong></span></td>
          <td height="19" colspan="2" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><span class="style10">
            <?=$i[9]?>
          </span></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="14" colspan="3" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000">&nbsp;</td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="20" colspan="3" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-bottom-style: solid; border-bottom-width: 1"><div align="center" class="style6 style11"><strong>Screenshot e Descri&ccedil;&atilde;o &raquo;</strong></div></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="13" colspan="3" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-bottom-style: solid; border-bottom-width: 1"><div align="center"><span class="style1"><span class="style6"><span class="style7"><span class="style11"><span class="style10">
              <?=$i[10]?>
          </span></span></span></span></span></div></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="25" colspan="3" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-bottom-style: solid; border-bottom-width: 1"><div align="center"><span class="style1"><span class="style6"><span class="style7"><span class="style11"><span class="style10">
            <?=$i[11]?>
</span></span></span></span></span></div></td>
        </tr>
        <tr valign="middle" class="style3">
          <td height="19" colspan="3">&nbsp;</td>
        </tr>
        <tr class="style3">
          <td height="19" colspan="3"><div align="center" class="style10"><a href="downloads/redir.php?url=<?=$i[12] ?>" target="_blank"><strong>Clique aqui para Download</strong></a></div></td>
        </tr>
      </table>
        <? } ?></td>
  </tr>
</table>

Ah, não tem com imprimir na primera tabela(html) a 1ª coluna(mysql)? sei lá separar pelo ID q é automático... não sei se explikei bem mas... a.. flws.s. :D

Share this post


Link to post
Share on other sites
  • 0

Eu num sei ond é o erro... ainda n tive tmpo pra arrumah isso aih... não é da conexão?? flwss... ;)

Share this post


Link to post
Share on other sites
  • 0

Linha 31 >>

while($i = mysql_fetch_row($SQL)){ ?>

alguém sab o q é?

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  



  • Forum Statistics

    • Total Topics
      148597
    • Total Posts
      644166
×
×
  • Create New...