doctorbill
asked on
php pdo loops
Attached file:
This objct is defined in the xml file being imported:
$orderdesc2 = (string)$obj->body->ORDER- >ORDERHEAD ->FUNCDESC ;
I have just noted that the data in the xml file is repeated but the insert command I have only inserts once. Please can someone show me how to insert a loop for this variable
such that it inserts the total number of records for that variable from the xml file into the database
Insert statement:
$stmt = $dbh->prepare("INSERT INTO retailers (ret_name, ret_add, ret_add2) VALUES (:name, :orderdesc, :orderdesc2)");
$stmt->bindParam('name', $name);
$stmt->bindParam('orderdes c', $orderdesc);
$stmt->bindParam('orderdes c2', $orderdesc2);
//execute the query
$stmt->execute();
xmlimport-form.php
This objct is defined in the xml file being imported:
$orderdesc2 = (string)$obj->body->ORDER-
I have just noted that the data in the xml file is repeated but the insert command I have only inserts once. Please can someone show me how to insert a loop for this variable
such that it inserts the total number of records for that variable from the xml file into the database
Insert statement:
$stmt = $dbh->prepare("INSERT INTO retailers (ret_name, ret_add, ret_add2) VALUES (:name, :orderdesc, :orderdesc2)");
$stmt->bindParam('name', $name);
$stmt->bindParam('orderdes
$stmt->bindParam('orderdes
//execute the query
$stmt->execute();
xmlimport-form.php
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How does this fit into the xmlimport-form.php file?
ie what does the xmlimport-form.php look like with this code inserted ?
ie what does the xmlimport-form.php look like with this code inserted ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much - working
It amazes me how you guys do this in seconds when it takes me ages to see the wood for the trees !!
It amazes me how you guys do this in seconds when it takes me ages to see the wood for the trees !!
ASKER
solution
ASKER
The repeat region is: body-ORDER-ORDEDRLINE-PROD
If I could just see the mechanism of how to enter the repeat
xml attached
Purchase-Order-FI2-4098098.xml