插入两个值 [英] Inserting two values

查看:93
本文介绍了插入两个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我在mysql中有2张桌子



优先

------

儿子

------------------------- ------------------

son_id

son_name

son_address

son_birthdate

son_tele

son_mobile

son_img

area_id

- -------------------------------------------------- -----------------------------

Second

---- -

参加

--------------

attend_id

attend_date

son_id

attend_type enum(参加,not_attend)

----------------- -------------------------------------------------- -

我使用下面的代码显示子表加上一个新选择选项列

Dears ,

I have 2 tables in mysql

first
------
sons
-------------------------------------------
son_id
son_name
son_address
son_birthdate
son_tele
son_mobile
son_img
area_id
---------------------------------------------------------------------------------
Second
------
attend
--------------
attend_id
attend_date
son_id
attend_type enum(attend,not_attend)
--------------------------------------------------------------------
I use the below code to display the son table plus add a new column of select option

while ($data=mysql_fetch_array($result))
       {

        echo "
        <tr>
        <td>$data[0]</td>
        <td>$data[1]</td>
        <td>$data[2]</td>
        <td>$data[3]</td>
        <td>$data[4]</td>
        <td>$data[5]</td>
        <td>
        <select name='selection[]' >
         <option value='1'>attend</option>
         <option value='2'>not attend</option>
        </select>
        </td>
        ";
       }





我需要的是插入表格[出席]值[日期,参加类型和son_id]

i前两个值没有问题[日期和参加类型(在选择选项中)]

我的问题是如何插入son_id,这取决于选择选项标签

以其他方式,select选项可以携带更多的一个值,它可以携带Enum的值和id的值吗?



All i need is to insert in table [ attend ] values [ date , attend type and son_id ]
i have no problem with the first 2 values [ date and attend type (which in select option) ]
My question is how to insert the son_id which is depending on the select option tag
in other way , can the select option carry more the one value , can it carry the value of Enum and the value of the id ?

推荐答案

data = mysql_fetch_array(
data=mysql_fetch_array(


result))
{

echo
< tr>
< td>
result)) { echo " <tr> <td>


data [0]< / td>
< td>
data[0]</td> <td>


这篇关于插入两个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆