Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在一个文本字段中显示数据库中的数据_Php_Loops_Input_Fetch - Fatal编程技术网

Php 如何在一个文本字段中显示数据库中的数据

Php 如何在一个文本字段中显示数据库中的数据,php,loops,input,fetch,Php,Loops,Input,Fetch,我试图做的是从一个简单的文本字段中显示SQL数据库中的数据,但是fetch数组所做的是显示多个表单字段,因为它像fetch数组那样循环这些字段 我怎样才能只有一个输入字段并显示其中的所有数据 您不需要我的代码,因为这是一个一般的php问题,但在这里 <?php $fetch_users_on_list = $db->query("SELECT * FROM table WHERE blocked_by='$username'"); $fetch_users_on_list_row

我试图做的是从一个简单的文本字段中显示SQL数据库中的数据,但是fetch数组所做的是显示多个表单字段,因为它像fetch数组那样循环这些字段

我怎样才能只有一个输入字段并显示其中的所有数据

您不需要我的代码,因为这是一个一般的php问题,但在这里

<?php

$fetch_users_on_list = $db->query("SELECT * FROM table  WHERE blocked_by='$username'");
$fetch_users_on_list_rows = $db->num_rows($fetch_users_on_list);

while($fetch = mysql_fetch_array($fetch_users_on_list)) {

if($fetch_users_on_list_rows>0) {
   $default_selected = selected;
}


$update_form = "
      <div style='position:relative;left:250px;'>
        <text> <a href='' id='post_update_link' style=''> Post A Update </a>  </text> |
        <text> <a href='' id='upload_update_image' style=''> Upload A Image </a></text>
      </div>
      <div>

        <form action='' method='POST'>

        <div class='row'>
          <div class='col-md-2'><img  class='img-circle' width='100%'/></div>
          <div class='col-md-10'>
          <textarea name='post_message' class='form-control' id='feedbox' rows='1' placeholder='What Is Going On?'></textarea>


<select name='_privacy_selection' id='_privacy_selection'>
  <option value='everyone'>Everyone Can See This Post</option>
  <option value='staff_only'>Only Me and Clan Staff Can See This Post</option>
    <option name='certain_users' id='certain_users' value='certain_users' $default_selected>Certain Users</option>
  </select><br><br>
  <text id='block_field' style='display:none;'>dd</text>

            <input type='submit' name='post_message_submit' id='button' class='btn btn-default' value='Publish'><br>             
          </div>
        </div>
    </div>

<input type='text' name='privacy_data' id='privacy_data' value=''>


<text id='sometext' style='display:none;position:relative;left:250px;''>
  <b>Select A Image To Post As A Update</b><br>

          <textarea name='say_something_update' class='form-control' id='feedbox' rows='3' cols='8' style='width:30%;' placeholder='Say Something About This'></textarea><br>

      <input type='file' class='form-control' id='image_upload' style='width:50%;' name='image'><br>
      <input type='text' name='youtube_upload' id='youtube_upload' style='width:50%;' placeholder='Specify A YouTube Video URL'><br><br>
      <input type='submit' id='button_upload' class='btn btn-default'  name='process_upload' value='Publish' />

      </form>

</text>

<!-- 
    -this is the actual dialog, yes, it is included in your html body, it is just hidden
    -you can set the dialog title via the 'title' tag 
-->
<div id='basicModal' title='Update Is Empty' style='display:none;'>
    This post appears to be empty please write a update or attach a image first before attempting to post
</div>

 <div id='ttt' title='Duplicate Update' style='display:none;'>
  You have already posted this update please wait $time_set minutes before posting again<br>

</div>

  <div id='post_privacy_options' title='Control Who Can See This Post' style='display:none;'>

  <b>Who Can View This Post?</b><br>
  <input type='text' name='add_share_with_control' id='add_share_with_control' placeholder='Leave Blank If You Want Everyone To View This'><br>
  <small>Note: Specify Each User With A Coma </small>
  <br><br>

  <b>Block These People From Viewing This Post</b><br>

  <input type='text' name='block_share_with_control' id='block_share_with_control' placeholder='Leave Blank To Block No One'><br>
  <small>Note: Specify Each User With A Coma, You cannot block clan staff</small><br>
  <input type='submit' name='submit_values' id='submit_values' value='Done'><br>
  <text id='privacy_control_dialog_messages'> </text>

</div>

<!-- include the jquery library -->
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script>

<!-- include the jquery ui library -->
<script src='//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'</script>
";
}
?>

我讨厌向下投票按钮,它显示了人们对一条新发布的帖子是多么自私,只是说:Anywya我希望有人能帮忙:(您能概述一下代码的作用吗?它似乎是从数据库加载数据,并为返回的每一行分配一个具有相同html的变量。您是想在一个文本字段中显示所有数据,还是只显示特定数据?我正在制作一个阻止列表功能,以使存储在该表中的用户始终被阻止。)当前的php代码只是创建更多的框,并单独显示每个数据