Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.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 - Fatal编程技术网

Php 如何将连接的值插入到单个列中?

Php 如何将连接的值插入到单个列中?,php,Php,我正在编写一个应用程序,从不同的表中查询数据,并在将它们插入角度表之前将它们连接在一起。我遇到了一些挑战,需要一些帮助。下面是我的一些代码: $sql="select employees.id as id,message_dispensary,message_surgery,message_biochemistry,heading from messages join supervisors

我正在编写一个应用程序,从不同的表中查询数据,并在将它们插入角度表之前将它们连接在一起。我遇到了一些挑战,需要一些帮助。下面是我的一些代码:

       $sql="select employees.id as  id,message_dispensary,message_surgery,message_biochemistry,heading 
               from messages
              join supervisors
                  using(employee_id)
               join employees
              on (employees.id=supervisors.employee_id)";   
             $result=mysqli_query($link,$sql) or die ("error in retrieving results.".mysqli_error($link));  
      while ($row=mysqli_fetch_assoc($result))
    {
        echo "<tr><td><input type='text' name='message[]' value=".$row['heading'].'&nbsp;'.$row['message_surgery'].'&nbsp;'.$row  ['message_biochemistry'].'&nbsp;'";?>
       "</td></tr>";
    }
        ?>
       <tr><td><input type="submit"> </form> </table>      
$sql=“选择employees.id作为id,message\u药房,message\u手术,message\u生物化学,标题
来自消息
加入主管
使用(员工id)
加入员工
on(employees.id=supervisors.employeer_id)”;
$result=mysqli_query($link,$sql)或die(“检索结果时出错”。.mysqli_error($link));
while($row=mysqli\u fetch\u assoc($result))
{
回声“
"";
}
?>
我的问题是如何获取我在名为“messages”的输入框中输入的“所有”值“…值不断截断,某些行没有某些值。请告诉我在哪里我错过了它,甚至一个更优雅的解决方案。谢谢

您可以尝试
而不是
,您可以通过
cols
属性来控制其长度和宽度:

       $sql="select employees.id as  id,message_dispensary,message_surgery,message_biochemistry,heading 
               from messages
              join supervisors
                  using(employee_id)
               join employees
              on (employees.id=supervisors.employee_id)";   
             $result=mysqli_query($link,$sql) or die ("error in retrieving results.".mysqli_error($link));  
      while ($row=mysqli_fetch_assoc($result))
    {
        echo "<tr><td><input type='text' name='message[]' value=".$row['heading'].'&nbsp;'.$row['message_surgery'].'&nbsp;'.$row  ['message_biochemistry'].'&nbsp;'";?>
       "</td></tr>";
    }
        ?>
       <tr><td><input type="submit"> </form> </table>      
echo "<textarea name='messages[]' cols='10' rows='10'>{$row['message_surgery']}</textarea>" ;
echo“{$row['message_surgery']}”;

您甚至可以有多个文本区域,每种消息类型一个。如果要编辑数据库数据并将其保存回数据库中,则在任何情况下都需要执行此操作。

您是否尝试过使用phpmyadmin?如果您怀疑某些内容在呈现为HTML时被隐藏,那么您可能应该在字段值上使用htmlspecialchars。还可以查看页面源代码。我需要将其作为脚本,因为我需要编写它,以便用户将内容插入数据库。当我将其插入表中时,它会被截断。是的,如果字符串长于列长度,则会发生这种情况,尽管MySQL会发出警告,您可以通过显示警告看到。您可以使用CONCAT函数CONCAT(标题“,”信息“,”信息“,”信息“,”生物化学)作为单列消息。好的,谢谢george…我会试试Ok fanis…我会这么做…但我需要将它们连接在一起,因为它们需要在一列中。我尝试了文本区域…但我选择的值都没有显示为值…即“$row['heading]”,我如何连接这些值?
       $sql="select employees.id as  id,message_dispensary,message_surgery,message_biochemistry,heading 
               from messages
              join supervisors
                  using(employee_id)
               join employees
              on (employees.id=supervisors.employee_id)";   
             $result=mysqli_query($link,$sql) or die ("error in retrieving results.".mysqli_error($link));  
      while ($row=mysqli_fetch_assoc($result))
    {
        echo "<tr><td><input type='text' name='message[]' value=".$row['heading'].'&nbsp;'.$row['message_surgery'].'&nbsp;'.$row  ['message_biochemistry'].'&nbsp;'";?>
       "</td></tr>";
    }
        ?>
       <tr><td><input type="submit"> </form> </table>