duan032225 2015-01-04 03:24
浏览 22
已采纳

MySQL中的PHP + HTML回声

This will in this case echo multiple authors, release dates, and covers for a book on a single page.

My question is: How do I make it look nice with a table, and my CSS file? I just can't get it right, kinda almost made it work once, but it showed just the one book and then started on a new row, and I want at least 4 books/row, and the borders were completely off.

Really silly question I know, and I've tried googling and experimenting but I'm having serious trouble making it really work.

Also, if I want to echo a variable ($genre) in a link-text, say

Home > Books > CurrentGenreVariable($genre)

how'd I do that neatly? I need a slight kick-start, that's all I think.

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dongnao9525 2015-01-04 05:06
    关注

    You follow the generic looping patterns. I presume you're doing this with a while() loop?

    <table>
        <?php while ($row = FETCH_THE_DATA): ?>
        <tr>
            <td><?php echo $row['author']; ?></td>
            <td><?php echo $row['date']; ?></td>
            <td><?php echo $row['cover']; ?></td>
        </tr>
        <?php endwhile; ?>
    </table>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)