Forum Moderators: coopster
Ok - Im a noob, unashamedly POOR at php & mysql haha. I've got a form that a user can submit to a mysql database (flat, only 1 table). Cool. I can list all records, filter & sort them blah blah blah (cos I've been googling like mad on this stuff!).
Here's the tricky part: I then want to be able to access a different page, and look at all the new submissions, and process all "new" data (ie: data I haven't previously processed). For each record I check, I want to "process", creating a separate text file for each record. For each record, I need to return the name of each field in the record, and the value of each field, delimited with some text (basically, writing a specific XML file).
The closest I've been able to come is this:
$query = "SELECT * FROM $table WHERE SubID = 1 OR SubID = 2";
$result = mysql_query($query) or die(mysql_error());
$record = mysql_fetch_assoc($result);
while (list($key, $value) = each ($record)) {
if ($key!= "SubID" && $key!= "ProducedTF") {
echo "\n{dbFieldName=".$key."}\n<br> {FieldValue}".$value."{/FieldValue}\n<br>{/dbFieldName}\n<BR>";
}
}
The above code will print a SINGLE record exactly how I want it, but for the life of me, Im too thick to make it do it for multiple records.
Any help would be greatly appreciated. And thanks for letting a noob like me in :)
Cheers,
Phatzo
Your code produced:
{dbFieldName=2}
{FieldValue}0{/FieldValue}
{/dbFieldName}
My code (originally) produced:
{dbFieldName=PLF_Name_TE}
{FieldValue}Company Pty Ltd{/FieldValue}
{/dbFieldName}
{dbFieldName=PLF_ACN_MC}
{FieldValue}ACN{/FieldValue}
{/dbFieldName}
etc...rinse & repeat for each field in record (currently 11 fields in each record)
Thanks for the help, I'll keep trying and keep reading the php manual, which presumes I have a clue haha.