Page 4 of 7
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 7:30 am
by phphelpme
Hi there.
I can understand your thoughts and feelings regards this but as coders, they will not want to develop a system that is slightly backwards thinking in relation to how they code. It is called 'standards' and that is what the PHP language is fundamentally based around.
I wish you luck in your thoughts about your system and I hope you get what you want in the end. However, you will run into problems as we all extend our systems as inevitably our needs or desires find something else that could help us.
Best wishes.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 7:31 am
by donny
that being said. i can do most of it, i just don't know how to take information out of my database and have it ran through a processing page separately.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 7:33 am
by donny
i don't know where it came off as backwards by just explaining what i needed done. thanks for your input!
and thanks for helping out the new guy! I'm sure you didn't learn everything without some help! i only know very little and i wuldnt know any of it if it weren't for people like celauran that actually help people instead of talk down to them like your some php god or something. i am a young kid and this is what i chose to do my summer instead of drink and smoke cigarettes with the "Cool kids"
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 7:37 am
by phphelpme
Hi there.
Look into the 'select' statement for extracting information from a database and also 'loops' such as, 'for' and 'foreach'. You have a number of choices about how you want to store the information while it is being ran through another script. The information will be stored as an array from the database and the 'loop' will allow you to extract that information from the array into separate string variables to use as and when you please.
Best wishes.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 7:38 am
by donny
i hope somebody can still help me though, i liked this forum and was learning a lot here.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 8:05 am
by Celauran
Here's the thing; you keep talking about running these orders through different 'scripts' but never actually explain what they do or what the differences between them are. I've been trying to help you come up with a process to automate this, to do exactly what you're describing, but as long as 'script' remains some black box there's little more I can do.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 8:11 am
by donny
its not possible to just use them the way they are? and just pass the data to them as if it were just me entering the information into a form?
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 8:19 am
by Celauran
They're separate pages that rely on POST data? Sure, that can be automated but you'd need to use cURL or something to send the POST data and that's messy and probably more work than just fixing the workflow into something more reasonable.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 8:24 am
by donny
i can fix the work flow myself but i wanted to have a page that shows all form data and then i can pick and chose when and which ones i want to be ran through the script. i don't want them all ran through it. i want to be able to pick and chose which ones are ran through it.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 8:28 am
by Celauran
Yes, that's been clear from the beginning. That's not a problem.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 8:29 am
by donny
i didnt think it was going to require so much work and changing around. i thought there was something small that can be put together that takes info from a database and runs it through to a page as if it were a form sending data to it. and do it automatically for each row that i select to go through.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 9:26 am
by donny
Celauran wrote:They're separate pages that rely on POST data? Sure, that can be automated but you'd need to use cURL or something to send the POST data and that's messy and probably more work than just fixing the workflow into something more reasonable.
yes they rely on post data now because they're made for forms
i will change all the variables to get data from an array instead
i am going to come into the page with a multidimensional array that will look like this
Code: Select all
<?php
$processthese = array(
array("ordernumber","formnumber","info1","info2","info3","info4","type"),
array("ordernumber","formnumber","info1","info2","info3","info4","type"),
array("ordernumber","formnumber","info1","info2","info3","info4","type"),
);
?>
now i need to know how to setup a loop/foreach that will take each array in $processthese and put run them through a script separately... i am just going to use my current script the way it is now and instead of getting data from POST it'll be from this array.
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 9:49 am
by Celauran
Then it would just be as simple as
Code: Select all
<?php
foreach ($processthese as $order) {
// do something here
// reference $order instead of $_POST
}
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 10:19 am
by donny
ok thanks a lot.
i am trying to set up my multi dimensional array.
i will have my view orders page where i select orders i want to process.
it'll bring it to the next page which will create a multidimensional array
right now i am testing a bunch of stuff and for some reason i have 4 things in my array and the foreach i made that pulls data into arrays only does 3 of them.
Code: Select all
<?
error_reporting(E_ALL);
$selected = array( "PH62W8" => "8482",
"PH62W8" => "7437",
"FRF856" => "5207",
"62R9PK" => "4696"
);
include 'dblogin.php';
foreach ($selected as $ordernumber => $formnumber) {
$query = "SELECT * FROM `rawdata` WHERE `ordernumber` = '$ordernumber' AND `formnumber` = '$formnumber'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$clientarray = array( "ordernumber" => $row['ordernumber'],
"formnumber" => $row['formnumber'],
"info1" => $row['info1'],
"info2" => $row['info2'],
"info3" => $row['info3'],
"info4" => $row['info4'],
"type" => $row['type']);
}
echo "Check box test<pre>" ;
print_r($clientarray);
echo "</pre>";
}
?>
i manually wrote in the ordernumbers and formnumbers and they do exist in the database. i know this is not creating a multidimensional array but just a single array, i was testing stuff as i learn.
any idea why i am only getting 3 results? i double checked 100 times and i am calling for the right order and form numbers?
thanks a lot
Re: PHP Batch Process? Is this Possible?
Posted: Thu Sep 04, 2014 10:27 am
by donny
i added 7 to the array and it only prints 4?
i don't know if its a coincidence but it only prints 1 for each order number, like 1 order number has 3 formnumbers . its only doing 1 formnumber for each ordernumber. i don't know if this is just a coincidence though.
edit. its no coincidence that is the problem. only doing 1 formnumber for each ordernumber