用php添加到mysql的多行 [英] Multiple rows added to mysql with php

查看:79
本文介绍了用php添加到mysql的多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在努力解决这个问题令人沮丧。


我有一个表格,其中我想要有字段WEEK,ID,FAVORITE,UNDERDOG,SPREAD,FSCORE,USCORE和TIME。


表格一次输入16行,而不是输入一次1个。我可以很容易地一次得到1条记录。你怎么得到所有20更新或插入?在这种情况下你是否必须使用阵列? FAVORITE和UNDERDOG字段来自下拉菜单,您可以在其中进行选择。以下是代码示例:

Hello All,

I am having a frustrating time trying to figure this out.

I have a form, in which I want to have fields WEEK, ID, FAVORITE, UNDERDOG, SPREAD, FSCORE, USCORE, and TIME.

The form is to have 16 rows to be entered at one time, instead of entering 1 at a time. I can get it to 1 record at a time easily enough. How do you get all 20 to update or insert? Do you have to use an array in this situation? The FAVORITE and UNDERDOG fields are from a drop down menu where you make a selection. Here is a sample of code:

展开 | 选择 | Wrap | 行号

推荐答案

Heya,Patsman。欢迎来到TSDN!


我不确定我是否跟进。您是否尝试输出带有控件的表单来更新多行,或者您是否已经设置了表单并且正在尝试处理输入?
Heya, Patsman. Welcome to TSDN!

I''m not sure I follow. Are you trying to output a form with controls to update multiple rows, or do you already have the form set up and are trying to process the input?


Thanx表示欢迎!!我很荣幸!我已经对此做了很多阅读,我觉得我需要看看我的案例是否独一无二......


我创建了示例中显示的表单,其中只提交了1条记录一次。我希望能够一次有16个记录条目...我可以将1周的游戏放入表单并提交。到目前为止,我唯一可以做的方法就是拥有不同的名称值,比如收藏夹,收藏夹2,收藏夹3 .....但它可以指出我的数据库中有超过100个字段,我只想要列出例如,fileds中每个记录都有不同的ID。所以我的数据库表看起来像:


GameID |周|收藏|失败者|传播|时间

01 01西雅图迈阿密7 13:00:00

02 01 Buffalo Detroit 4.5 16:00:00



它在DB表中的外观是我希望我的表单看起来如何...我将输入信息,然后将其更新为DB。


Patsman77
Thanx for the welcome!! I am honored! I have done so much reading on this, I felt I needed to see if my case was unique....

I created the form shown in example, which is only 1 record submitted at a time. I want to be able to have 16 record entries at 1 time... where I can put 1 weeks worth of games into the form and submit it. The only method I could do so far is to have different name values, like Favorite, Favorite2, Favorite3..... but it gets to point that I would have over 100 fields in my database, where I just want to have the listed fileds in example, where each record would have a different ID. So my DB table would look like:

GameID | Week | Favorite | Underdog | Spread | Time
01 01 Seattle Miami 7 13:00:00
02 01 Buffalo Detroit 4.5 16:00:00


How it would look in DB table is how I would want my form to look...where I would enter the information, then update it to DB.

Patsman77


我担心你也失去了我,但它可能只是你所指的可怕的美国运动。是棒球吗?
I''m afraid you have lost me also, but it might just be the awful American sport you are referring to. Is it baseball?

我希望一次可以有16个记录条目
I want to be able to have 16 record entries at 1 time



Do你的意思是将16条记录插入数据库?是的,没问题

Do you mean insert 16 records into the DB? Yes that is no problem


我可以将1周的游戏放入表格并提交
where I can put 1 weeks worth of games into the form and submit it



您必须将数据放在某处,除非它是由代码生成的。

You have to place the data somewhere unless it is generated by code.


到目前为止,我唯一可以做的方法就是拥有不同的名称值,比如收藏夹,收藏夹2,收藏夹3 ......但它指出我会在我的数据库中有超过100个字段,
The only method I could do so far is to have different name values, like Favorite, Favorite2, Favorite3..... but it gets to point that I would have over 100 fields in my database,



Nope,在那里迷失了我。如果这是你得到的最接近的,你可以提供你尝试的代码。

看看你想要做什么可能会有所帮助。

Nope, lost me there. If this is the closest you get can you provide the code you attempted.
It may help to see what you are trying to do.


这篇关于用php添加到mysql的多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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