如何通过php和MySQL显示数据?

时间:2016-02-09 10:21:52

标签: php html mysql

我有多个信息框,我使用纯粹的html,css和jQuery来显示它们。但是,更新或编辑它们非常耗时,因为这意味着每次必须进行编辑或更新时都要重写每个信息框。因此,我正在尝试在服务器端设置它,我想我正在尝试通过包含从MySQL返回的数据的PHP数组创建一个循环。但我不确定。如果有人有更好的显示解决方案,请纠正我。

此处信息框示例FIDDLE

信息框的示例代码

<div class="pin" id="pin8"><!-- VAC CARD -->
 <div class="pull-right intrest-box">
   <input type="checkbox" class="faChkRnd" name="c8" id="like8"> </div>
<p class="pull-left">05.02.16 </p><!--DATE -->
   <h1 class="text-left"> write in here </h1><!-- JOB TITLE -->
   <p><b>INFO:</b> write in here <br><!-- COMPANY NAME -->
   <b>INFO:</b>
   <br>&#149; Paste a info here.
   <br>&#149; Paste a info here.
   <br>&#149; Paste a info here.
   <br>&#149; Paste a info here.
   <br>&#149; Paste a info here.
   </p>
   <div class="text-center">
  <div class="hidden">INFO</div>
<p class="card-title"><a target="_blank" href=" paste link in here " class="">Click</a></p><!-- link to job-->
 </div>
</div>

真的很感激任何帮助。如果我使用任何不正确的术语,我会道歉,我正在努力学习它们。

1 个答案:

答案 0 :(得分:0)

例如:

<div class="pinGridWrapper">

  <?php foreach ($data as $value) { ?>
  <div class="pin" id="pin10">
    <div class="pull-right intrest-box">
      <input type="checkbox" class="faChkRnd" name="c10" id="like10"> </div>
      <p class="pull-left"><?php echo $value['date']; ?></p>
      <h1 class="text-left"> <?php echo $value['job_title']; ?> </h1>
      <p><b>INFO:</b><?php echo $value['company_name']; ?><br>
        <b>INFO:</b>
        <br>&#149; Paste a info here.
        <br>&#149; Paste a info here.
        <br>&#149; Paste a info here.
        <br>&#149; Paste a info here.
        <br>&#149; Paste a info here.
      </p>
      <div class="text-center">
        <div class="hidden">INFO</div>
        <p class="card-title"><a target="_blank" href=" paste link in here " class="">CLick</a></p>
      </div>
    </div>
    <?php } ?>
  </div>