开发者

How to insert concatenated values into single column?

i am writing an application that queries data from different tables and concatenates them together before it inserts them into angle table.I am running into a few challenges,and will need some help.Below is some of my code:

       $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>      

my problem is how to get "ALL" the values i am placing in the input box named "messages"...the values keep truncating, and some rows do开发者_开发百科 not have some of the values. Please show me where i am missing it or even a more elegant solution.Thanks....


You could try <textarea> instead of <input type='text'>, whose length and width you can control by the cols and rows attributes:

echo "<textarea name='messages[]' cols='10' rows='10'>{$row['message_surgery']}</textarea>" ;

You can even have multiple textareas, one for each message type. If you are going to edit the database data and save it back in the database you will need to do this in any case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜