PHP Batch Process? Is this Possible?
Moderator: General Moderators
Re: PHP Batch Process? Is this Possible?
You've got foreach loops inside foreach loops all to fetch data you've already got. Is there any reason it needs to be like that? What, ultimately, are you doing with the data? Directly operating on each row from the initial query, what data do you need that you wouldn't have?
Re: PHP Batch Process? Is this Possible?
your right that will work. I'm new remember!!! lol cool stuff though!
now the question is!! I'm going to run all this data through a foreach again that will include the code. what will this look like?
now the question is!! I'm going to run all this data through a foreach again that will include the code. what will this look like?
Re: PHP Batch Process? Is this Possible?
You'll have to be more specific than 'the code'. The processing script we looked at the other day? Some field in a database?
Re: PHP Batch Process? Is this Possible?
Code: Select all
foreach (each array formnumber data seperatly) {
$data1e = strtoupper($data1fromarray);
$data2e = strtoupper($data2fromarray);
$data3e = strtoupper($data3fromarray);
$data4e = strtoupper($data4fromaray);
$type = $type_from_array;
$rawsql = "INSERT INTO edited
(ordernumber, formnumber, data1e, data2e, data3e, data4e)
VALUES('$ordernumber','$formnumber','$data1e','$data2e','$data3e','$data4e')";
mysql_query($rawsql);
}
Re: PHP Batch Process? Is this Possible?
Instead of executing your query inside your loop, though, build it up inside the loop and run one query at the end.
Re: PHP Batch Process? Is this Possible?
how can i do that? the script will be changing the variables for all the different formnumber submissions thats getting passed through it.
also can you show me how to setup the foreach to go through the array we just made? i also need to know how to call the data out of them too
also can you show me how to setup the foreach to go through the array we just made? i also need to know how to call the data out of them too
Re: PHP Batch Process? Is this Possible?
put all edited results into an array? query the array after?
Re: PHP Batch Process? Is this Possible?
This
becomes thisdonny wrote:Code: Select all
foreach (each array formnumber data seperatly) { $data1e = strtoupper($data1fromarray); $data2e = strtoupper($data2fromarray); $data3e = strtoupper($data3fromarray); $data4e = strtoupper($data4fromaray); $type = $type_from_array; $rawsql = "INSERT INTO edited (ordernumber, formnumber, data1e, data2e, data3e, data4e) VALUES('$ordernumber','$formnumber','$data1e','$data2e','$data3e','$data4e')"; mysql_query($rawsql); }
Code: Select all
$query = "SELECT `ordernumber`, `form number`, UPPER(`info1`), UPPER(`info2`), UPPER(`info3`), UPPER(`info4`), `type` FROM `rawdata` WHERE `ordernumber` IN ($list)";
$results = mysql_query($query);
$values = array();
while ($row = mysql_fetch_assoc($results)) {
$values[] = "('{$row['ordernumber']}', '{$row['formnumber']}', '{$row['info1']}', '{$row['info2']}', '{$row['info3']}', '{$row['info4']}')";
}
$query = "INSERT INTO `edited` (ordernumber, formnumber, data1e, data2e, data3e, data4e) VALUES ";
$query .= implode(',', $values);
mysql_query($query);Re: PHP Batch Process? Is this Possible?
Although, looking at it, you're just taking values from one table and copying them directly to another table. What am I missing?
Re: PHP Batch Process? Is this Possible?
theres more to it than that, i just put that up there for the example.
Re: PHP Batch Process? Is this Possible?
forget about the code thats being ran and forget about the mysql thats just complicating things...
i need to run the array $ordercid through this... i need set variables based on the information in each array
all i need is to run each array through this foreach. the variables being set need to be updated for each array that is going through it.
thank you so much!!!!
i need to run the array $ordercid through this... i need set variables based on the information in each array
Code: Select all
foreach (each array formnumber data seperatly) {
//set variables
$data1 = $GET_DATA1_FROM_ARRAY
$data2 = $GET_DATA2_FROM_ARRAY
$data3 = $GET_DATA3_FROM_ARRAY
$data4 = $GET_DATA4_FROM_ARRAY
//MY CODING WILL BE HERE
}
thank you so much!!!!
Re: PHP Batch Process? Is this Possible?
Code: Select all
Array
(
[ORDERNUMBER] => Array
(
[0] => Array
(
[0] => dataforinfo1
[info1] => dataforinfo1
[1] => dataforinfo2
[info2] => dataforinfo2
[2] => dataforinfo3
[info3] => dataforinfo3
[3] => dataforinfo4
[info4] => dataforinfo4
[4] => datafortype
[type] => datafortype
[5] => dataforformnumber
[formnumber] => dataforformnumber
)
[1] => Array
(
[0] => dataforinfo1
[info1] => dataforinfo1
[1] => dataforinfo2
[info2] => dataforinfo2
[2] => dataforinfo3
[info3] => dataforinfo3
[3] => dataforinfo4
[info4] => dataforinfo4
[4] => datafortype
[type] => datafortype
[5] => dataforformnumber
[formnumber] => dataforformnumber
)
)
[ORDERNUMBER] => Array
(
[0] => Array
(
[0] => dataforinfo1
[info1] => dataforinfo1
[1] => dataforinfo2
[info2] => dataforinfo2
[2] => dataforinfo3
[info3] => dataforinfo3
[3] => dataforinfo4
[info4] => dataforinfo4
[4] => datafortype
[type] => datafortype
[5] => dataforformnumber
[formnumber] => dataforformnumber
)
)
)
i need to run them through a foreach separately
under each ORDERNUMBER i have form data submissions. each ordernumber is unique and can have multiple form data submissions.
i need to be able to assign the data from the form submissions into variables in the foreach.
my foreach should look something like this.
Code: Select all
foreach (each array formnumber data seperatly) {
//set variables
$info1 = dataforinfo1;
$info2 = dataforinfo2;
$info3 = dataforinfo3;
$info4 = dataforinfo4;
$type = datafortype;
$formnumber = dataforformnumber;
//MY CODING WILL BE HERE
}
and then i need help assigning the data from the arrays into variables.
thanks a lot!!!