How to Insert Record with multiple rows

Hello alls,
i want to ask something... how to use insert record server behavior -  php myysql, to insert multiple rows from textfiled?
thanks.

It would have been more helpful if you had shown me your existing code. However, this shows the basic principles.
First of all, the name of each input field in the form needs to end in an empty pair of square brackets like this:
<input type="text" name="field_name[]" . . .
This results in $_POST['field_name'] being treated as an array of the values in each input field. Change field_name to the actual name of the input field. Without the square brackets, only the last value is submitted by the form.
The Insert Record server behavior code looks like this:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO my_table (field1, field2) VALUES (%s, %s)",
                       GetSQLValueString($_POST['field1'], "int"),
                       GetSQLValueString($_POST['field2'], "text"));
  mysql_select_db($database_connAdmin, $connAdmin);
  $Result1 = mysql_query($insertSQL, $connAdmin) or die(mysql_error());
  $insertGoTo = "another_page.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  header(sprintf("Location: %s", $insertGoTo));
You need to amend it like this:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  mysql_select_db($database_connAdmin, $connAdmin);
  // loop through the input values
  for ($i = 0, $len = count($_POST['field1']); $i < $len; $i++) {
      $insertSQL = sprintf("INSERT INTO my_table (field1, field2) VALUES (%s, %s)",
                            GetSQLValueString($_POST['field1'][$i], "int"),
                            GetSQLValueString($_POST['field2'][$i], "text"));
      $Result1 = mysql_query($insertSQL, $connAdmin) or die(mysql_error());
  } // end loop
  $insertGoTo = "another_page.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  header(sprintf("Location: %s", $insertGoTo));
This uses a for loop (see http://docs.php.net/manual/en/control-structures.for.php) to access each element of the $_POST['field1'] and $_POST['field2'] arrays (see http://docs.php.net/manual/en/language.types.array.php).

Similar Messages

  • How to insert records with LONG RAW columns from one table to another

    Does anybody know how to use subquery to insert records with columns of LONG RAW datatype from one table to another? Can I add a WHERE clause in the subquery statement? Thanks.

    Insert into ... Select statements are not supported for long or long raw. You will have to either use PL/SQL or convert your long raw to blobs.

  • Fetch Multiple row in repor to insert data with multiple rows .

    Hi Friends
    i want to Insert emp attendance .
    There are 10 emp in company .they enter there arival time in attendance register .
    i have two item
    1--p1_att_date
    2--p1_status
    ATTEN_STATUS are PRESENT by default in selectlist .
    i want, when i enter date in p1_att_date item and Press submit then generate a report with 10 employee and insert in_time in report and when press enter then data with 10 emp should insert in to table ABC .
    i don't want to use tabularform for this .actully i don't want to use ADD_ROW option to ADD attendance for second emp.so please give me some solution.
    Emp_ID     ATTEN_DATE     ATTEN_STATUS      IN_TIME     OUT_TIME
    101     22-JAN-2009     PRESENT          
    102     22-JAN-2009     PRESENT          
    103     22-JAN-2009     PRESENT          
    104     22-JAN-2009     PRESENT          
    105     22-JAN-2009     PRESENT          
    106     22-JAN-2009     PRESENT          
    107     22-JAN-2009     PRESENT          
    108     22-JAN-2009     PRESENT          
    109     22-JAN-2009     PRESENT          
    110     22-JAN-2009     PRESENT     
    My table is :-
    table Name --ABC
    emp_id number;
    atten_date date;
    atten_status varchar2(12);
    in_time timestemp;
    out_time timestemp;
    How can i do this.
    Thanks
    Manoj

    Hi Manoj,
    You can create multiple records easily using a single, simple, form. However, you would surely have to enter in the times individually using a tabular form (otherwise, you would have to use the same form 10 times). You do not have to keep the Add Row option on the page - this functionality can be removed.
    Andy

  • How to Insert record in IT0014 along with cost Assignment details - FM Pls.

    Hi,
    I want to insert record in info type 0014 along with Cost Assigment details.
    I used FM - HR_INFOTYPE_OPERATION and RP_PLANT_DATA_UPDATE_TABLES.
    It works fine, but if I go and check PA20 after execution of program, ICON (Cost Assignment details) is not showing up on screen PA20. But If I check cost assignment tables (ASSOB & ASSHR) the record is present.
    Please let me know how to insert record in IT0014 along with Cost Assignment details.
    Thanks in Advance,
    Krishna

    Hi,
    I want to insert record in info type 0014 along with Cost Assigment details.
    I used FM - HR_INFOTYPE_OPERATION and RP_PLANT_DATA_UPDATE_TABLES.
    It works fine, but if I go and check PA20 after execution of program, ICON (Cost Assignment details) is not showing up on screen PA20. But If I check cost assignment tables (ASSOB & ASSHR) the record is present.
    Please let me know how to insert record in IT0014 along with Cost Assignment details.
    Thanks in Advance,
    Krishna

  • Loading xml file with multiple rows

    I am loading data from xml files using xsl for transformation. I have created xsl's and loaded some of the data. In an xml file with multiple row, it's only loading one (the first) row. Any idea how I can get it to read and load all the records in the file???

    Could some please help me with the above. I desparately need to move forward.

  • How to insert records into an Excel file

    i was wondering if anyone knows how to insert records from a pl/sql block straight into an excel file

    try with spool or UTL_FILE...
    Re: CSV into Oracle and Oracle into CSV
    SQL> spool c:\test1.csv
    SQL> select substr(str,2,length(str)-3) from (select regexp_replace(column_value,'\s*<[^>]*>[^>]*>',',') str from table(xmlsequence(cursor(select * from test_emp))));
    SUBSTR(STR,2,LENGTH(STR)-3)
    9999,fredi&apos;s,CLERK,2345,10-OCT-06,1250,123,20
    4567,STEWART,ANALYST,3456,02-APR-07,3200,215,30
    2345,Cockrel,CLERK,7566,23-JAN-82,800,30
    3 rows selected.
    SQL> spool off;

  • TO DRAW A TABLE WITH MULTIPLE ROWS AND MULTIPLE COLOUMNS IN FORM

    Hi,
       How to draw a table with multiple rows and columns seperated by lines in form printing?

    check this
    http://sap-img.com/ts003.htm
    Regards
    Prabhu

  • I have regisetred a EIT with multiple rows Yes, can we change it NO now.

    I have registered a EIT with multiple rows Yes, can we change it NO now.

    Hi,
    Yes you can change this through back-end.
    Register extra information (types) concurrent program run the package HR_REGISTER_EITS and insert definintion of an EIT in respective INFO_TYPES tabel for example if person EIT then definition is stored in PER_PEOPLE_INFO_TYPES.
    In this table we have column MULTIPLE_OCCURENCES_FLAG which can have value as Y or N, Y - Multiple entries allowed, N - Multiple entries not allowed.
    You need to update the value of this flag to N for your EIT definition and you are done.
    Thanks,
    Sanjay

  • Procedure to insert data in multiple rows

    Hi,
    I need a stored procedure which inserts data into multiple rows..
    Ex: I need to have 3 columns in Procedure, where col3 has limit in size let's say 500.
    If user insert about 1500 in col3, i has to insert first 500 in row1 and 501 - 1000 in row 2 and 1001 - 1500 in row 3.
    Can any one help in creating procedure for above scenario.
    Thanks in Advance...
    Sree

    create table #t (id int, id1 int)
    WITH [1-20]
    AS
    SELECT row_number() over (order by number) rn,number
            FROM master..spt_values
             WHERE type = 'P'
             AND number BETWEEN 1 AND 20
     [21-30]
    AS
    SELECT row_number() over (order by number) rn,number
            FROM master..spt_values
             WHERE type = 'P'
             AND number BETWEEN 21 AND 30
    ) INSERT INTO #t 
      SELECT A.number,B.number FROM
         [1-20] A JOIN [21-30] B ON A.rn=B.rn
    SELECT * FROM #t
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • JTable with Multiple Row Header

    well, Im do an application thats need formated ISOS Sheets, and most of them have a Table with Multiple Row Header , and Groupable Header, and both of them. I have the .java and in the class MultipleRowHeaderExample calls a class AttributiveCellTableModel for setColumnIdentifiers() and setDataVector() the cue is why this print stack :
    Exception in thread "main" java.lang.StackOverflowError
         at java.util.Vector.<init>(Unknown Source)
         at java.util.Vector.<init>(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:54)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
    .if in main class, have initialized the data, and column vars
    public class MultipleRowHeaderExample extends JFrame {
      Object[][] data;
      Object[] column;
      JTable table;
      MultiSpanCellTable fixedTable;
      public MultipleRowHeaderExample() {
        super( "Multiple Row Header Example" );
        setSize( 400, 150 );
        data =  new Object[][]{
            {"SNo."    ,"" },
            {"Name"    ,"1"},
            {""        ,"2"},
            {"Language","1"},
            {""        ,"2"},
            {""        ,"3"}};
        column = new Object[]{"",""};
        AttributiveCellTableModel fixedModel = new AttributiveCellTableModel(data, column) {
          public boolean CellEditable(int row, int col) {
            return false;
        };

    What's the code in AttributiveCellTableModel?
    * (swing1.1beta3)
    package jp.gr.java_conf.tame.swing.table;
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    * @version 1.0 11/22/98
    public class AttributiveCellTableModel extends DefaultTableModel {
      protected CellAttribute cellAtt;
      public AttributiveCellTableModel() {
        this((Vector)null, 0);
      public AttributiveCellTableModel(int numRows, int numColumns) {
        Vector names = new Vector(numColumns);
        names.setSize(numColumns);
        setColumnIdentifiers(names);
        dataVector = new Vector();
        setNumRows(numRows);
        cellAtt = new DefaultCellAttribute(numRows,numColumns);
      public AttributiveCellTableModel(Vector columnNames, int numRows) {
        setColumnIdentifiers(columnNames);
        dataVector = new Vector();
        setNumRows(numRows);
        cellAtt = new DefaultCellAttribute(numRows,columnNames.size());
      public AttributiveCellTableModel(Object[] columnNames, int numRows) {
        this(convertToVector(columnNames), numRows);
      public AttributiveCellTableModel(Vector data, Vector columnNames) {
        setDataVector(data, columnNames);
      public AttributiveCellTableModel(Object[][] data, Object[] columnNames) {
        setDataVector(data, columnNames);
      public void setDataVector(Vector newData, Vector columnNames) {
        if (newData == null)
          throw new IllegalArgumentException("setDataVector() - Null parameter");
        dataVector = new Vector();
        setColumnIdentifiers(columnNames);
        dataVector = newData;
        cellAtt = new DefaultCellAttribute(dataVector.size(),
                                           columnIdentifiers.size());
        newRowsAdded(new TableModelEvent(this, 0, getRowCount()-1,
               TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      @Override
      public void setColumnIdentifiers(Vector arg0) {
              // TODO Auto-generated method stub
              super.setColumnIdentifiers(arg0);
      public void addColumn(Object columnName, Vector columnData) {
        if (columnName == null)
          throw new IllegalArgumentException("addColumn() - null parameter");
        columnIdentifiers.addElement(columnName);
        int index = 0;
        Enumeration enumeration = dataVector.elements();
        while (enumeration.hasMoreElements()) {
          Object value;
          if ((columnData != null) && (index < columnData.size()))
           value = columnData.elementAt(index);
          else
         value = null;
          ((Vector)enumeration.nextElement()).addElement(value);
          index++;
        cellAtt.addColumn();
        fireTableStructureChanged();
      public void addRow(Vector rowData) {
        Vector newData = null;
        if (rowData == null) {
          newData = new Vector(getColumnCount());
        else {
          rowData.setSize(getColumnCount());
        dataVector.addElement(newData);
        cellAtt.addRow();
        newRowsAdded(new TableModelEvent(this, getRowCount()-1, getRowCount()-1,
           TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      public void insertRow(int row, Vector rowData) {
        if (rowData == null) {
          rowData = new Vector(getColumnCount());
        else {
          rowData.setSize(getColumnCount());
        dataVector.insertElementAt(rowData, row);
        cellAtt.insertRow(row);
        newRowsAdded(new TableModelEvent(this, row, row,
           TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      public CellAttribute getCellAttribute() {
        return cellAtt;
      public void setCellAttribute(CellAttribute newCellAtt) {
        int numColumns = getColumnCount();
        int numRows    = getRowCount();
        if ((newCellAtt.getSize().width  != numColumns) ||
            (newCellAtt.getSize().height != numRows)) {
          newCellAtt.setSize(new Dimension(numRows, numColumns));
        cellAtt = newCellAtt;
        fireTableDataChanged();
      public void changeCellAttribute(int row, int column, Object command) {
        cellAtt.changeAttribute(row, column, command);
      public void changeCellAttribute(int[] rows, int[] columns, Object command) {
        cellAtt.changeAttribute(rows, columns, command);
    }that's it

  • Splitting a message with multiple rows from the JDBC Adapter

    Hi,
    I'd like to split the resultset message with multiple row elements and process each row separately..
    Does someone have this experience?
    Thanx, Peter

    Hi Chandrasekhar,
    I tried to follow your advise, but I'm not able to complete the process correctly.
    Let me explain my process:
    First - output from the JDBC adapter goes into the first receive step. Of course, there are multiple ROW elements. (Should be marked the ingoing message marked in the container as Multiline??)
    The next should be the transformation:
    format of the source message is like
    <message>
      <row>
        <column>w</column>
      </row>
      <row>
        <column>w</column>
      </row>
    </message>
    In the message I have the ROW element as 0..unbounded
    and <column> element exactly 1
    This message should be mapped to multiple messages of the format:
    <message>
      <value>w</value>
    </message>
    How should be the mapping be done?
    Is it N:1 or 1:N (because in another thread there was an 1:N mapping advised)
    Then (as you say) should follow the Block step:
    Which message (container element) should be marked as Multiline? And what does it mean: Current Message?
    Can you give me some advise, when and how to use the multiline mark?
    Thanx a lot, Peter

  • Web dynpro screen with multiple rows with columns that can be edited

    Web dynpro screen with multiple rows with columns that can be edited individually:
    Hi
    I am busy creating a screen in web dynpro for ABAP which we would like to make available via Portal ESS (Portal 7).
    I need to add 'n type of table (or almost something like Excel) or something in which someone can type a few paycode numbers (there should be lets say 10 blank rows in which info can be typed in and if I click on a button or so, more rows must be added if necessary.  Then in the other colums stuff like amounts must be entered which one should also be able to edit then and there.
    Can anyone assist in what I can use for this?  There does not seem to be some existing element that I can use.
    Help will be appreciated.
    Regards
    Debbie

    Hi Debbie,
    Whiel Creating table you need to be care full that use chose INPUT FIELD as the CELL EDITOR. Just guessing that if ur table is not editable u might have choosen TextView as default cell editor type.
    check link for details on TABLE UI
    [http://help.sap.com/saphelp_erp2005/helpdata/EN/b5/ac884118aa1709e10000000a155106/frameset.htm]
    easy way is to first add UI ELEMENT TABLE to your VIEW, then right click over it & select create binding from context. After you have a pop up where you can select what columns you want what should be its cell editor etc.
    Greetings
    Prashant

  • How to show records with zero on dashboard

    hi expert,
    if I have a dimension table product,
    a fact table
    if in the db, there are records with zero values of product A.
    if the logical column for the fact is SUM(...).
    how to show records with zero values on dashboard.
    Use the outer join?
    or other method?
    I dont wanna use outer join because it makes the PRD be so complicated

    hi,
    Pull all the columns to criteria ,it will show NULL for a product
    To get zero,on the fact column use IFNULL(fact_col,0)
    which will look like this
    http://a.imageshack.us/img180/6616/ifnull.jpg
    thanks,
    saichand.v

  • How to create parameter with multiple selection in a query (SQ02) ?

    Hi Exports
    Do you know how to create parameter with multiple selection in a query (transaction SQ02)?
    thanks.

    Hi
    i know how to create user parameter at SQ02,
    the question is how to create multiple selection parameter?

  • How do i deal with multiple iPhoto libraries when migrating to Photos

    how do i deal with multiple iPhoto libraries when migrating to Photos

    I would merge them before the migration.  Also, spend some time doing any batch changes of names and dates beforehand too.
    iPhoto Library Manager has good merge and duplicate search facilities.
    http://www.fatcatsoftware.com/iplm/

Maybe you are looking for

  • Amend this Program

    I wan to amend this program so that I will be able to enter 6 lotto numbers. The program currently is randomly selecting 6 numbers but I want to enter the number not generate them any help please? Thank you! import javax.swing.*; // for the graphical

  • Top 10 chart and legend problem

    Post Author: training2go CA Forum: Charts and Graphs Hello, I am using CR for Visual Studio 2005.I create a top 10 chart with a legend. The chart is in the group header 1b section and I'm using the underlay option so that the chart is to the right of

  • Change encoding from utf-8 to ISO-8859-1

    Hi I have a problem with changeing the encoding of a text. The text is in utf-8, but when I try to send the text as mail with javax.mail and "text/html", Outlook doesn't want to display the right characters. Can somebody help me?

  • I have a lot of movies on my computer and need to free up memory.  What is the best solution, if I think I may need these movies in the future?

    I'm an elementary music teacher and my students perform regularly so I have a lot of their performances on my computer.  Now I need to free up memory so am wondering what the best solution would be, given that I may need access to these movies again

  • Business one to SAP one (All in one)

    I am a fresh SAP FICO certified individual, I have applied for (SAP ERP one) position in one of the renowned consultancy firm, how ever they have approached saying any they do not have vacancy on SAP ERP one but they can offer me a position in Busine