Discussion:
Foreach and mydql_query problem
Karl-Arne Gjersøyen
2013-07-22 06:19:57 UTC
Permalink
Hello again.
I have this this source code that not work as I want...

THe PHP/HTHML form fields is generated by a while loop and looks like this:

<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">


the php source code look like this:
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');

foreach($number_of_items as $itemi){
echo "$itemi<br>";

$sql = "UPDATE item_table SET number_item = '$item' WHERE date
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}

?>

The problem is:
Foreach list every items as expected in PHP doc and I thought that $sql and
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written when
update the form..
I believe this is becayse number_of_items = '$item in $sqk override every
earlier result.

So my querstion is. How to to update the database in this case?

Thanks again for your good advice and time to help me.

Karl'
Tamara Temple
2013-07-22 07:04:22 UTC
Permalink
Post by Karl-Arne Gjersøyen
Hello again.
I have this this source code that not work as I want...
<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');
foreach($number_of_items as $itemi){
echo "$itemi<br>";
$sql = "UPDATE item_table SET number_item = '$item' WHERE date
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}
?>
Foreach list every items as expected in PHP doc and I thought that $sql and
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written when
update the form..
I believe this is becayse number_of_items = '$item in $sqk override every
earlier result.
So my querstion is. How to to update the database in this case?
Thanks again for your good advice and time to help me.
Karl'
Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stuart Dallas
2013-07-22 08:03:41 UTC
Permalink
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
Hello again.
I have this this source code that not work as I want...
<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');
foreach($number_of_items as $itemi){
echo "$itemi<br>";
$sql = "UPDATE item_table SET number_item = '$item' WHERE date
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}
?>
Foreach list every items as expected in PHP doc and I thought that $sql and
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written when
update the form..
I believe this is becayse number_of_items = '$item in $sqk override every
earlier result.
So my querstion is. How to to update the database in this case?
Thanks again for your good advice and time to help me.
Karl'
Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code.
The error is rather obvious: it loops around an array running an update statement that will modify a single row in the table, so it's not surprising that it appears like only the last entry in the array has been stored.

-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Karl-Arne Gjersøyen
2013-07-22 11:56:26 UTC
Permalink
Post by Tamara Temple
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
Hello again.
I have this this source code that not work as I want...
THe PHP/HTHML form fields is generated by a while loop and looks like
<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');
foreach($number_of_items as $itemi){
echo "$itemi<br>";
$sql = "UPDATE item_table SET number_item = '$item' WHERE date
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}
?>
Foreach list every items as expected in PHP doc and I thought that $sql
and
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written
when
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
update the form..
I believe this is becayse number_of_items = '$item in $sqk override
every
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
earlier result.
So my querstion is. How to to update the database in this case?
Thanks again for your good advice and time to help me.
Karl'
Either the code you posted isn't the actual code, or if it is, the
errors should be rather obvious. Post *actual* code.
The error is rather obvious: it loops around an array running an update
statement that will modify a single row in the table, so it's not
surprising that it appears like only the last entry in the array has been
stored.
Yes, i know that only one a singe row is updated and that is the problem.
What can I do to update several rows at the same time?
Thank you very much for all your good adivce.

Karl
Stuart Dallas
2013-07-22 12:20:06 UTC
Permalink
Post by Karl-Arne Gjersøyen
Post by Tamara Temple
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
Hello again.
I have this this source code that not work as I want...
THe PHP/HTHML form fields is generated by a while loop and looks like
<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');
foreach($number_of_items as $itemi){
echo "$itemi<br>";
$sql = "UPDATE item_table SET number_item = '$item' WHERE date
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}
?>
Foreach list every items as expected in PHP doc and I thought that $sql
and
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written
when
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
update the form..
I believe this is becayse number_of_items = '$item in $sqk override
every
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
earlier result.
So my querstion is. How to to update the database in this case?
Thanks again for your good advice and time to help me.
Karl'
Either the code you posted isn't the actual code, or if it is, the
errors should be rather obvious. Post *actual* code.
The error is rather obvious: it loops around an array running an update
statement that will modify a single row in the table, so it's not
surprising that it appears like only the last entry in the array has been
stored.
Yes, i know that only one a singe row is updated and that is the problem.
What can I do to update several rows at the same time?
Thank you very much for all your good advice.
Are you sure you want to update several rows, or do you actually want to insert several rows?

This is pretty basic database stuff, and is off-topic for this list.

-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Karl-Arne Gjersøyen
2013-07-22 12:25:35 UTC
Permalink
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
Post by Tamara Temple
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
Hello again.
I have this this source code that not work as I want...
THe PHP/HTHML form fields is generated by a while loop and looks like
<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');
foreach($number_of_items as $itemi){
echo "$itemi<br>";
$sql = "UPDATE item_table SET number_item = '$item' WHERE
date
Post by Karl-Arne Gjersøyen
Post by Tamara Temple
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}
?>
Foreach list every items as expected in PHP doc and I thought that
$sql
Post by Karl-Arne Gjersøyen
Post by Tamara Temple
and
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written
when
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
update the form..
I believe this is becayse number_of_items = '$item in $sqk override
every
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
earlier result.
So my querstion is. How to to update the database in this case?
Thanks again for your good advice and time to help me.
Karl'
Either the code you posted isn't the actual code, or if it is, the
errors should be rather obvious. Post *actual* code.
The error is rather obvious: it loops around an array running an update
statement that will modify a single row in the table, so it's not
surprising that it appears like only the last entry in the array has
been
Post by Karl-Arne Gjersøyen
Post by Tamara Temple
stored.
Yes, i know that only one a singe row is updated and that is the
problem.
Post by Karl-Arne Gjersøyen
What can I do to update several rows at the same time?
Thank you very much for all your good advice.
Are you sure you want to update several rows, or do you actually want to
insert several rows?
This is pretty basic database stuff, and is off-topic for this list.
OK. Sorry. I thought it was a PHP question for a way to update several
mysql rows by PHP code.

Karl
Stuart Dallas
2013-07-22 12:30:22 UTC
Permalink
Post by Stuart Dallas
Post by Karl-Arne Gjersøyen
Post by Tamara Temple
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
Hello again.
I have this this source code that not work as I want...
THe PHP/HTHML form fields is generated by a while loop and looks like
<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');
foreach($number_of_items as $itemi){
echo "$itemi<br>";
$sql = "UPDATE item_table SET number_item = '$item' WHERE date
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}
?>
Foreach list every items as expected in PHP doc and I thought that $sql
and
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written
when
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
update the form..
I believe this is becayse number_of_items = '$item in $sqk override
every
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
earlier result.
So my querstion is. How to to update the database in this case?
Thanks again for your good advice and time to help me.
Karl'
Either the code you posted isn't the actual code, or if it is, the
errors should be rather obvious. Post *actual* code.
The error is rather obvious: it loops around an array running an update
statement that will modify a single row in the table, so it's not
surprising that it appears like only the last entry in the array has been
stored.
Yes, i know that only one a singe row is updated and that is the problem.
What can I do to update several rows at the same time?
Thank you very much for all your good advice.
Are you sure you want to update several rows, or do you actually want to insert several rows?
This is pretty basic database stuff, and is off-topic for this list.
OK. Sorry. I thought it was a PHP question for a way to update several mysql rows by PHP code.
If you want to UPDATE several rows then you must have unique identifiers for those rows. If you don't then I'm guessing what you actually want to do is INSERT those rows.

It's off-topic in the same way as asking a mechanic how to fit a bunch of stuff in your car. It's the MySQL part that you're having a problem with, not the PHP. I strongly recommend that you use the MySQL command line to run the queries you think you need to run, checking what the table looks like after each one. Once you know what queries you need to run you will more effectively be able to write the PHP wrapper around those queries.

-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Karl-Arne Gjersøyen
2013-07-22 11:39:16 UTC
Permalink
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
Hello again.
I have this this source code that not work as I want...
THe PHP/HTHML form fields is generated by a while loop and looks like
<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');
foreach($number_of_items as $itemi){
echo "$itemi<br>";
$sql = "UPDATE item_table SET number_item = '$item' WHERE date
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}
?>
Foreach list every items as expected in PHP doc and I thought that $sql
and
Post by Karl-Arne Gjersøyen
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written
when
Post by Karl-Arne Gjersøyen
update the form..
I believe this is becayse number_of_items = '$item in $sqk override every
earlier result.
So my querstion is. How to to update the database in this case?
Thanks again for your good advice and time to help me.
Karl'
Either the code you posted isn't the actual code, or if it is, the errors
should be rather obvious. Post *actual* code.
// The acutual source code is below:
// ==============================================
if(!empty($_POST['antall_kolli'])){
include('../../tilkobling.php');

foreach($antall_kolli as $kolli){
echo "$kolli<br>";

// echo $kolli. "<br>";
$sql = "UPDATE transportdokument SET antall_kolli_stk =
'$kolli' WHERE dato = '$dagens_dato' AND signatur = '$brukernavn'";
mysql_query($sql,$tilkobling) or die(mysql_error());
}
}

// THE PHP/HTML Form below:
include('../../tilkobling.php');

$sql = "SELECT * FROM transportdokument WHERE dato = '$dagens_dato' AND
signatur = '$brukernavn'";
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
while($rad = mysql_fetch_array($resultat, MYSQL_ASSOC)){
$valgt_lager = $rad['valgt_lager'];
$un_nr = $rad['un_nr'];
$sprengstofftype = $rad['sprengstofftype'];
$varenavn = $rad['varenavn'];
$varenr = $rad['varenr'];
$antall_kolli = $rad['antall_kolli_stk'];
$adr_vekt_kg = $rad['adr_vekt_kg'];
$varenavn = $rad['varenavn'];
$emb = $rad['emb'];
?>
<tr>
<td align="left" valign="top"><?php echo "$un_nr"; ?></td>
<td align="left" valign="top"><strong>Sprengstoff</strong>,<?php echo
"$sprengstofftype"; ?></td>
<td align="left" valign="top"><?php echo "$varenavn"; ?></td>
<td align="left" valign="top"><strong>1.1D</strong></td>
<td align="left" valign="top">&nbsp;</td>
<td align="left" valign="top"><?php echo "$emb"; ?></td>
<td align="left" valign="top">
<input type="hidden" name="varenr[]" value="<?php echo "$varenr"; ?>">
<input type="number" name="antall_kolli[]" size="6" value="<?php echo
"$antall_kolli"; ?>" required="required">
</td>
<td align="left" valign="top"><input type="text" name="exan_kg_ut[]"
size="6" value="<?php echo "$adr_vekt_kg"; ?>" required="required"></td>
</tr>
<?php
$total_mengde_kg_adr += $rad['adr_vekt_kg'];
$total_antall_kolli += $rad['antall_kolli_stk'];
}

?>
include('../../tilkobling.php');

$sql = "SELECT * FROM transportdokument WHERE dato = '$dagens_dato' AND
signatur = '$brukernavn'";
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
while($rad = mysql_fetch_array($resultat, MYSQL_ASSOC)){
$valgt_lager = $rad['valgt_lager'];
$un_nr = $rad['un_nr'];
$sprengstofftype = $rad['sprengstofftype'];
$varenavn = $rad['varenavn'];
$varenr = $rad['varenr'];
$antall_kolli = $rad['antall_kolli_stk'];
$adr_vekt_kg = $rad['adr_vekt_kg'];
$varenavn = $rad['varenavn'];
$emb = $rad['emb'];
?>
<tr>
<td align="left" valign="top"><?php echo "$un_nr"; ?></td>
<td align="left" valign="top"><strong>Sprengstoff</strong>,<?php echo
"$sprengstofftype"; ?></td>
<td align="left" valign="top"><?php echo "$varenavn"; ?></td>
<td align="left" valign="top"><strong>1.1D</strong></td>
<td align="left" valign="top">&nbsp;</td>
<td align="left" valign="top"><?php echo "$emb"; ?></td>
<td align="left" valign="top">
<input type="hidden" name="varenr[]" value="<?php echo "$varenr"; ?>">
<input type="number" name="antall_kolli[]" size="6" value="<?php echo
"$antall_kolli"; ?>" required="required">
</td>
<td align="left" valign="top"><input type="text" name="exan_kg_ut[]"
size="6" value="<?php echo "$adr_vekt_kg"; ?>" required="required"></td>
</tr>
<?php
$total_mengde_kg_adr += $rad['adr_vekt_kg'];
$total_antall_kolli += $rad['antall_kolli_stk'];
}

?>
Jim Giner
2013-07-22 14:45:30 UTC
Permalink
Your original code snippet had some errors. It really couldn't have
been what you wanted to do.

Example:

You have a named field of 'number_of_items' and then you try to retreive
$_POST['number_of_itemsi']. That won't work.

Then you have a var called $number_of_items which we don't see defined,
and you are assigning each to $itemi but then you use $item in your
query. Very Confusing!!

Perhaps if you clean up the errors you might see better results.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Lucas
2013-07-22 17:50:23 UTC
Permalink
On 07/22/2013 04:39 AM, Karl-Arne Gjersøyen wrote:
Might I suggest that you place your include for ../../tilkobling.php at
the very top of this page? It would save you from possibly including it
twice.
Post by Karl-Arne Gjersøyen
// ==============================================
if(!empty($_POST['antall_kolli'])){
include('../../tilkobling.php'); --- remove this line
foreach($antall_kolli as $kolli){
echo "$kolli<br>";
// echo $kolli. "<br>";
$sql = "UPDATE transportdokument SET antall_kolli_stk =
'$kolli' WHERE dato = '$dagens_dato' AND signatur = '$brukernavn'";
mysql_query($sql,$tilkobling) or die(mysql_error());
}
Your WHERE conditions are the same, that is why it is updating a single
row. Where are $dagens_dato and $brukernavn being defined? As others
have stated, you need to include a unique identifier in your query so
your query updates a specific record.
Post by Karl-Arne Gjersøyen
}
include('../../tilkobling.php'); --- move this to the top of the script
$sql = "SELECT * FROM transportdokument WHERE dato = '$dagens_dato' AND
signatur = '$brukernavn'";
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
while($rad = mysql_fetch_array($resultat, MYSQL_ASSOC)){
$valgt_lager = $rad['valgt_lager'];
$un_nr = $rad['un_nr'];
$sprengstofftype = $rad['sprengstofftype'];
$varenavn = $rad['varenavn'];
$varenr = $rad['varenr'];
$antall_kolli = $rad['antall_kolli_stk'];
$adr_vekt_kg = $rad['adr_vekt_kg'];
$varenavn = $rad['varenavn'];
$emb = $rad['emb'];
?>
<tr>
<td align="left" valign="top"><?php echo "$un_nr"; ?></td>
<td align="left" valign="top"><strong>Sprengstoff</strong>,<?php echo
"$sprengstofftype"; ?></td>
<td align="left" valign="top"><?php echo "$varenavn"; ?></td>
<td align="left" valign="top"><strong>1.1D</strong></td>
<td align="left" valign="top">&nbsp;</td>
<td align="left" valign="top"><?php echo "$emb"; ?></td>
<td align="left" valign="top">
<input type="hidden" name="varenr[]" value="<?php echo "$varenr"; ?>">
<input type="number" name="antall_kolli[]" size="6" value="<?php echo
"$antall_kolli"; ?>" required="required">
</td>
<td align="left" valign="top"><input type="text" name="exan_kg_ut[]"
size="6" value="<?php echo "$adr_vekt_kg"; ?>" required="required"></td>
</tr>
<?php
$total_mengde_kg_adr += $rad['adr_vekt_kg'];
$total_antall_kolli += $rad['antall_kolli_stk'];
}
?>
--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Tim Streater
2013-07-22 12:14:00 UTC
Permalink
Post by Tamara Temple
Yes, i know that only one a singe row is updated and that is the problem.
What can I do to update several rows at the same time?
Which several rows? The row that will be updated is that (or those) that match your WHERE clause. Seems to me you should make sure your WHERE is correct.
--
Cheers -- Tim
Karl-Arne Gjersøyen
2013-07-22 12:20:34 UTC
Permalink
Post by Tim Streater
Post by Tamara Temple
Yes, i know that only one a singe row is updated and that is the problem.
What can I do to update several rows at the same time?
Which several rows? The row that will be updated is that (or those) that
match your WHERE clause. Seems to me you should make sure your WHERE is
correct.
Thanks, Tim.
Yes the form is generated in a while loop and have <input type="number"
name="number_of_items[]" size="6" value="<?php echo "$item"; ?>">. This
field is in several product rows and when I update the form the foreach
loop write all (5) products correct. But the other way: Update actual rows
in the database did not work. Only the latest row is updated..

Karl
Karl-Arne Gjersøyen
2013-07-23 15:02:43 UTC
Permalink
It works now and it was a php thing.When I combine a for and while loop
together with Limit in my query it works.
Karl
Shouldn't $_POST['number_of_itemsi'] be $_POST['number_of_items']
Kind Regards,
Liam.
3Sharp Ltd.
T: 0845 6018370
F: 0845 6018369
-----Original Message-----
Sent: 22 July 2013 12:39
To: PHP Mailinglist
Subject: Re: [PHP] Foreach and mydql_query problem
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
Hello again.
I have this this source code that not work as I want...
THe PHP/HTHML form fields is generated by a while loop and looks like
<input type="number" name="number_of_items[]" size="6" value="<?hp
echo "$item"; ?>" required="required">
<?php
if(!empty($_POST['number_of_itemsi'])){
include('../../connect.php');
foreach($number_of_items as $itemi){
echo "$itemi<br>";
$sql = "UPDATE item_table SET number_item = '$item' WHERE
date
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
= '$todays_date' AND sign = '$username'";
mysql_query($sql,$connect) or die(mysql_error());
}
}
?>
Foreach list every items as expected in PHP doc and I thought that $sql
and
Post by Karl-Arne Gjersøyen
mysql_query should be run five times when I have five items.
But the problem is that only the very last number_of_items is written
when
Post by Karl-Arne Gjersøyen
update the form..
I believe this is becayse number_of_items = '$item in $sqk override
every
Post by Tamara Temple
Post by Karl-Arne Gjersøyen
earlier result.
So my querstion is. How to to update the database in this case?
Thanks again for your good advice and time to help me.
Karl'
Either the code you posted isn't the actual code, or if it is, the errors
should be rather obvious. Post *actual* code.
// ==============================================
if(!empty($_POST['antall_kolli'])){
include('../../tilkobling.php');
foreach($antall_kolli as $kolli){
echo "$kolli<br>";
// echo $kolli. "<br>";
$sql = "UPDATE transportdokument SET antall_kolli_stk =
'$kolli' WHERE dato = '$dagens_dato' AND signatur = '$brukernavn'";
mysql_query($sql,$tilkobling) or die(mysql_error());
}
}
include('../../tilkobling.php');
$sql = "SELECT * FROM transportdokument WHERE dato = '$dagens_dato' AND
signatur = '$brukernavn'";
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
while($rad = mysql_fetch_array($resultat, MYSQL_ASSOC)){
$valgt_lager = $rad['valgt_lager'];
$un_nr = $rad['un_nr'];
$sprengstofftype = $rad['sprengstofftype'];
$varenavn = $rad['varenavn'];
$varenr = $rad['varenr'];
$antall_kolli = $rad['antall_kolli_stk'];
$adr_vekt_kg = $rad['adr_vekt_kg'];
$varenavn = $rad['varenavn'];
$emb = $rad['emb'];
?>
<tr>
<td align="left" valign="top"><?php echo "$un_nr"; ?></td>
<td align="left" valign="top"><strong>Sprengstoff</strong>,<?php echo
"$sprengstofftype"; ?></td>
<td align="left" valign="top"><?php echo "$varenavn"; ?></td>
<td align="left" valign="top"><strong>1.1D</strong></td>
<td align="left" valign="top">&nbsp;</td>
<td align="left" valign="top"><?php echo "$emb"; ?></td>
<td align="left" valign="top">
<input type="hidden" name="varenr[]" value="<?php echo "$varenr"; ?>">
<input type="number" name="antall_kolli[]" size="6" value="<?php echo
"$antall_kolli"; ?>" required="required">
</td>
<td align="left" valign="top"><input type="text" name="exan_kg_ut[]"
size="6" value="<?php echo "$adr_vekt_kg"; ?>" required="required"></td>
</tr>
<?php
$total_mengde_kg_adr += $rad['adr_vekt_kg'];
$total_antall_kolli += $rad['antall_kolli_stk'];
}
?>
include('../../tilkobling.php');
$sql = "SELECT * FROM transportdokument WHERE dato = '$dagens_dato' AND
signatur = '$brukernavn'";
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
while($rad = mysql_fetch_array($resultat, MYSQL_ASSOC)){
$valgt_lager = $rad['valgt_lager'];
$un_nr = $rad['un_nr'];
$sprengstofftype = $rad['sprengstofftype'];
$varenavn = $rad['varenavn'];
$varenr = $rad['varenr'];
$antall_kolli = $rad['antall_kolli_stk'];
$adr_vekt_kg = $rad['adr_vekt_kg'];
$varenavn = $rad['varenavn'];
$emb = $rad['emb'];
?>
<tr>
<td align="left" valign="top"><?php echo "$un_nr"; ?></td>
<td align="left" valign="top"><strong>Sprengstoff</strong>,<?php echo
"$sprengstofftype"; ?></td>
<td align="left" valign="top"><?php echo "$varenavn"; ?></td>
<td align="left" valign="top"><strong>1.1D</strong></td>
<td align="left" valign="top">&nbsp;</td>
<td align="left" valign="top"><?php echo "$emb"; ?></td>
<td align="left" valign="top">
<input type="hidden" name="varenr[]" value="<?php echo "$varenr"; ?>">
<input type="number" name="antall_kolli[]" size="6" value="<?php echo
"$antall_kolli"; ?>" required="required">
</td>
<td align="left" valign="top"><input type="text" name="exan_kg_ut[]"
size="6" value="<?php echo "$adr_vekt_kg"; ?>" required="required"></td>
</tr>
<?php
$total_mengde_kg_adr += $rad['adr_vekt_kg'];
$total_antall_kolli += $rad['antall_kolli_stk'];
}
?>
--
Hjemmeside: http://www.karl-arne.name/
Loading...