Using Shared Object data to populate a MySQL table

I’ve got a sequence of numbers in a Shared Object that I would like to write to an MySQL database table. I’m thinking that the data items in the SO should be turned into an array:


var soldItemSO:SharedObject = SharedObject.getLocal("soldItems", "/");
var soldItemNum:Array = [];
for (var i:Number = 1; i <= 10; i++) {
    if (soldItemSO.data* != undefined) {
        soldItemNum[i - 1] = soldItemSO.data*;
    }
}

And then some code to send the vars:


var LoadVarsSender:LoadVars = new LoadVars();
LoadVarsSender.onLoad = function(success:Boolean) {
    if (success) {
        trace("success");
}
LoadVarsSender.soldItem = soldItemNum; //Problem spot
LoadVarsSender.sendAndLoad("writeToDbase.php",LoadVarsSender,"POST");
}

And PHP to write to the database:


(writeToDbase.php)

<?php
$soldItem = $_POST['soldItem'];

$link = mysql_connect("localhost", "root","password") or die ("Unable to connect to database.");
mysql_select_db("gallery") or die ("Unable to select database.");
$sqlstatement= "INSERT INTO products (artworks) VALUES ('$artworks')";
mysql_close($link);
?>

I’m confused about how I would write individual rows into the database table since “soldItemNum” is going to have a number of data slots, and each slot should end up as a single row in the database table. Does that make sense? I’m not sure where I should loop through the array of items.