This code (script1) is putting several entries from a HTML form into a db. I think it is to bulky and it will get even more so once I will enter 30 datasets into the db. For a solution I would like to increment the variables by an index number through a do while loop. I just don't know how to do this.
My try is in script 2.
//SCRIPT 1
<?php
//putbank.php
include "common.inc";
$link_id = db_connect ();
$query = "INSERT INTO bank VALUES (NULL, '$date','$cheq' ,'$supplier' ,'$purchaser' , '$int_invoice_no', '$invoice_no',
'$in', '$out', '$description')";
echo "<table border=10>
<tr><td>$date</td>
<td>$cheq</td>
<td>$supplier</td>
<td>$purchaser</td>
<td>$int_invoice_no</td>
<td>$invoice_no</td>
<td>$in</td>
<td>$out</td>
<td>$description</td>
</table>";
if (!$query)
{
echo 'Entry was not successful. Please call 094 or 094 or mail to frankalbers@gmx.de';
}
else
{
echo 'Entry was successful. Thank you!';
}
$result = mysql_query ($query);
$query = "INSERT INTO bank VALUES (NULL, '$date1','$cheq1' ,'$supplier1' ,'$purchaser1' , '$int_invoice_no1', '$invoice_no1',
'$in1', '$out1', '$description1')";
echo "<table border=10>
<tr><td>$date1</td>
<td>$cheq1</td>
<td>$supplier1</td>
<td>$purchaser1</td>
<td>$int_invoice_no1</td>
<td>$invoice_no1</td>
<td>$in1</td>
<td>$out1</td>
<td>$description1</td>
</table>";
if (!$query)
{
echo 'Entry was not successful. Please call 0949 or 094 or mail to frankalbers@gmx.de';
}
else
{
echo 'Entry was successful. Thank you!';
}
$result = mysql_query ($query);
?>
//SCRIPT2
<?php
//putbank.php
include "common.inc";
$counter="1";
do
{
$counter = $counter +1;
$link_id = db_connect ();
$query = "INSERT INTO bank VALUES (NULL, '$date','$cheq' ,'$supplier' ,'$purchaser' , '$int_invoice_no', '$invoice_no',
'$in', '$out', '$description')";
echo "<table border=10>
<tr><td>$date</td>
<td>$cheq</td>
<td>$supplier</td>
<td>$purchaser</td>
<td>$int_invoice_no</td>
<td>$invoice_no</td>
<td>$in</td>
<td>$out</td>
<td>$description</td>
</table>";
if (!$query)
{
echo 'Entry was not successful. Please call 09491628698188 or 0949429899 or mail to frankalbers@gmx.de';
}
else
{
echo 'Entry was successful. Thank you!';
}
$result = mysql_query ($query);
$date="$date+1";
$cheq="$cheq+1";
$supplier="$supplier"+1;
$purchaser="$purchaser"+1;
$int_invoice_no='$int_invoice_no+1';
$invoice_no='$invoice_no'+1;
$in=$in+1;
$out=$out+1;
$description=$description+1;
//all of these did not work
}
while ($counter<=2);
?>