473,785 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Importing Inventory

Hi,

Not really a PHP specific question, but I am using PHP on Linux box so
it's kinda relevant.

I'm developing a site which will periodically update inventory via a
large batch file. I'm wondering if anyone has ideas, caveats, etc on
how to update the inventory. At the moment, I'm simply uploading the
batch file via a web interface and in that same PHP page executing sql
to populate the database with the data from the batch file. Is this
the best way? Should I write a shell script to do it? Should it be
done via the web or should someone have to log into the box to do it?
In all, it takes about 30 seconds to do the import, if that makes any
difference.

Cheers,

Oleg
Jul 17 '05 #1
4 2094
ni*********@yah oo.com (Oleg) wrote in message news:<d7******* *************** ****@posting.go ogle.com>...
Hi,

Not really a PHP specific question, but I am using PHP on Linux box so
it's kinda relevant.

I'm developing a site which will periodically update inventory via a
large batch file. I'm wondering if anyone has ideas, caveats, etc on
how to update the inventory. At the moment, I'm simply uploading the
batch file via a web interface and in that same PHP page executing sql
to populate the database with the data from the batch file. Is this
the best way? Should I write a shell script to do it? Should it be
done via the web or should someone have to log into the box to do it?
In all, it takes about 30 seconds to do the import, if that makes any
difference.


If it's taking about 30 seconds, then I would be weary of trying to do
it using a PHP script, unless you change the max execution time in the
configuration.

I'd look at running some kind of cron job to move the data, but that
all depends on where its coming from and what format its in...
Jul 17 '05 #2
"Oleg8" wrote:
Hi,

Not really a PHP specific question, but I am using PHP on Linux box so it’s kinda relevant.

I’m developing a site which will periodically update inventory
via a
large batch file. I’m wondering if anyone has ideas, caveats,
etc on
how to update the inventory. At the moment, I’m simply uploading
the
batch file via a web interface and in that same PHP page executing sql to populate the database with the data from the batch file. Is this
the best way? Should I write a shell script to do it? Should it be
done via the web or should someone have to log into the box to do it? In all, it takes about 30 seconds to do the import, if that makes any difference.

Cheers,

Oleg


http is not a very reliable protocol. If you continue using it, then
I suggest you have checksums and retries to make sure it does not
break.

Alternatively you call ftp the file over. It is a much better process
IMO, and easily done with php.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Importin...ict141976.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=474832
Jul 17 '05 #3
>I'm developing a site which will periodically update inventory via a
large batch file. I'm wondering if anyone has ideas, caveats, etc on
how to update the inventory. At the moment, I'm simply uploading the
batch file via a web interface and in that same PHP page executing sql
to populate the database with the data from the batch file. Is this
I'd talk SQL directly to the database with whatever protocol the
database provides to update the inventory. You could do this from
the same machine the database is on (ftp the file in and have a
script (possibly standalone PHP) see it and process it), or run the
database client remotely (MySQL offers remote database connections,
and you can use SSL if you want more security).

Database transaction features may be desirable to lock out web
access while the inventory is in the middle of updating.

A "large batch file" update doesn't sound like something you want
to do in one HTTP transaction, especially given that you probably
want PHP's execution time limit for most of the rest of the site.

the best way? Should I write a shell script to do it? Should it be
done via the web or should someone have to log into the box to do it?
In all, it takes about 30 seconds to do the import, if that makes any
difference.


You haven't said much about security issues. How sensitive is it if
someone grabs a copy of the data? How about if someone alters it
maliciously?

Gordon L. Burditt
Jul 17 '05 #4
go***********@b urditt.org (Gordon Burditt) wrote in message news:<cg******* *@library2.airn ews.net>...
I'm developing a site which will periodically update inventory via a
large batch file. I'm wondering if anyone has ideas, caveats, etc on
how to update the inventory. At the moment, I'm simply uploading the
batch file via a web interface and in that same PHP page executing sql
to populate the database with the data from the batch file. Is this


I'd talk SQL directly to the database with whatever protocol the
database provides to update the inventory. You could do this from
the same machine the database is on (ftp the file in and have a
script (possibly standalone PHP) see it and process it), or run the
database client remotely (MySQL offers remote database connections,
and you can use SSL if you want more security).

Database transaction features may be desirable to lock out web
access while the inventory is in the middle of updating.

A "large batch file" update doesn't sound like something you want
to do in one HTTP transaction, especially given that you probably
want PHP's execution time limit for most of the rest of the site.

the best way? Should I write a shell script to do it? Should it be
done via the web or should someone have to log into the box to do it?
In all, it takes about 30 seconds to do the import, if that makes any
difference.


You haven't said much about security issues. How sensitive is it if
someone grabs a copy of the data? How about if someone alters it
maliciously?

Gordon L. Burditt


Thanks for the replies guys. Confirms hunches I had, which helps me
sleep better ;)

Regarding the security, if someone alters it maliciously it would
definately be a bad thing. If I get the file to the server via SCP or
HTTPS, I assume it should be okay in transit. Correct me if I'm wrong.

The problem with connecting remotely directly via mysql is I've got to
make it such that a non-programmer can do the inventory updating.
Perhaps if I could use stored procs this would be okay, but the app is
using mysql 4 and IIRC they are available only in mysql 5. As far as
I know there's no non-programmery way of doing this is there?

For the moment, I'm thinking of writing a shell script in php which
would do the updating. The user would log in via ssh, upload the file
via scp, and run the script. At the moment the script would

- create a temp table
- import the data into the temp table via load data infile
- do a bunch of validation on the data in the temp table
- use a bunch of inserts for each row to distribute the data to
various tables in the db (making sure the inserts are atomic). (Is
there an alternative to using x number of inserts per row where x =
the number of different tables into to which the data should be
inserted?)

I was thinking of doing all this via a webpage and using shell_exec()
but I need to get responses from the procedure in case something goes
wrong and I'd again have the php script execution timeout issue.

Does this sound like a solid way of doing things? Anything I'm
missing? Is there a more user friendly way of doing it so ye olde
non-programmer doesn't have run a shell script?

Thanks again for the suggestions
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3434
by: gregork | last post by:
I have painstakingly created an excel 2000 workbook for the very complex recipes I have to formulate. I have 2 sheets- 1 for configuring the recipe and 1 that is like an inventory of all the raw materials and their specifications. I have many lookup formulas on sheet1 that lookup the specs on the inventory. The problem is sheet 1 works really well but sheet 2 is not really performing as an inventory database like I want it to. The...
13
3998
by: royaltiger | last post by:
I am trying to copy the inventory database in Building Access Applications by John L Viescas but when i try to run the database i get an error in the orders form when i click on the allocate button "Unexpected Error":3251 operation is not supported for this type of object.The demo cd has two databases, one is called inventory and the other just has the tables for the design called inventory data. When you run inventory the database works...
109
25892
by: zaidalin79 | last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the assignments... 4. CheckPoint: Inventory Program Part 1 • Resource: Java: How to Program • Due Date: Day 5 forum • Choose a product that lends itself to an inventory (for example, products at your workplace, office supplies, music CDs, DVD...
0
7116
by: south622 | last post by:
I'm taking a beginning Java course and I'm stuck in week eight of a nine week course. If anyone could help me I would greatly appreciate it. This assignment was due yesterday and each day I go past the due date 10% of the grade is taken off. I think I'm coming down with the flu and my brain is just not processing this assignment. Here is the assignment: Modify the Inventory program by adding a button to the GUI that allows the user to move...
9
7612
by: xxplod | last post by:
I am suppose to modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the output should display the value of the entire inventory. • Create a method to calculate...
3
7001
by: cblank | last post by:
I need some help if someone could help me. I know everyone is asking for help in java. But for some reason I'm the same as everyone else when it comes to programming in java. I have an inventory program that I have built so far with no problem. But I cannot figure out how to turn it into a GUI application. This is what I'm trying to get it to do. Modify the Inventory Program to use a GUI. The GUI should display the information one product...
2
2543
by: pinkf24 | last post by:
I cannot figure out how to add the following: Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each unit. An item added to the inventory should have an item number one more than the previous last item. Add a Save button to the GUI that saves the...
1
2661
by: jcato77 | last post by:
I need help with a class project I'm working on, Below is my assignment and the code I have currently created. Assignment: Modify the Inventory Program by creating a subclass of the product class that uses one additional unique feature of the product you chose (for the DVDs subclass, you could use movie title, for example). In the subclass, create a method to calculate the value of the inventory of a product with the same name as the method...
3
4487
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the GUI should display the value of the entire inventory, the additional attribute, and the restocking fee. Here is my Inventory program from 1 to 3: package...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.