This has certainly been covered before as i haave found references in the manual and on these archives. Trouble is I simply do not understand the syntax behind the resolution.
I have two arrays:
$scorearray = array();
$scorearray[1] = $pqasso_result;
$scorearray[2] = $iip_result;
$scorearray[3] = $iso_result;
$scorearray[4] = $excel_result;
$scorearray[5] = $social_result;
$scorearray[6] = $qmark_result;
$scorearray[7] = $chmark_result;
$scorearray[8] = $qfirst_result;
$scorearray[9] = $balanced_result;
$scorearray[10] = $bigpic_result;
$qsarray =array();
$qsarray[1] = "Pqasso";
$qsarray[2] = "Investors in People";
$qsarray[3] = "ISO 9001";
$qsarray[4] = "Excellence Model";
$qsarray[5] = "Social Auditing";
$qsarray[6] = "Quality Mark";
$qsarray[7] = "Charter Mark";
$qsarray[8] = "Quality First";
$qsarray[9] = "Balanced Scorecard";
$qsarray[10] = "Big Picture";
foreach scorearray and qsarray value im trying to insert into a table called qualityuser_score the qualityuser_id, qualitysystem, and score.
For example
I get the last inserted id from the other table....
$sql = mysql_query("SELECT MAX(qualityuser_id) AS id FROM qualityuser");
$id = mysql_result($sql, 0, 'id');
then I insert the id, quality system and score so the database will look like this:
qualityuser_scoreid qualityuser_id quality_system score
1 1 pqasso 4000
2 1 iip 5000
3 1 iso 10000
im stuck on how to handle foreach inserts for multidimensional arrays (From the manual I can now assume an array will be called 'score' and will have three dimensions - qualityuser_id,quality_system and score) but how do insert multiple arrays other than like so:
foreach($score as $key=>$value)
{
$sql = "INSERT into qualityuser_score (qualityuser_id, qualitysystem,score) VALUES
$id , $quality_system, $score";
}