05-09-2017, 07:31 PM
speaking of the db, I'm comfortable creating a patch file to update or create table/rows/columns etc, until i want to add multiple values to multiple columns, for example:
lets say my table is:
<pre></pre>
now i want to update the table with multiple values for each column, for instance in column "name" i have 20 poppy names i need inserting,
normally if it was one value i would just do this:
<pre></pre>
can user spice handle this ? or do i just have to import .sql via phpmyadmin?
lets say my table is:
<pre>
Code:
$ctr1 = $db->query("CREATE TABLE <code>poppies</code> (
<code>id</code> int(11) NOT NULL,
<code>name</code> varchar(50) NOT NULL,
<code>alpha_2</code> varchar(2) NOT NULL,
<code>alpha_3</code> varchar(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1");
$ctr2 = $db->query("ALTER TABLE <code>poppies</code> ADD PRIMARY KEY (<code>id</code>)");
$ctr3 = $db->query("ALTER TABLE <code>poppies</code> MODIFY <code>id</code> int(11) NOT NULL AUTO_INCREMENT");
now i want to update the table with multiple values for each column, for instance in column "name" i have 20 poppy names i need inserting,
normally if it was one value i would just do this:
<pre>
Code:
$fields = array(
'name' => 'yellow poppy',
'alpha_2' => '',
'alpha_3' => '',
);
$ctr4 = $db->insert('poppies',$fields);
can user spice handle this ? or do i just have to import .sql via phpmyadmin?