472,328 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

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 1997
ni*********@yahoo.com (Oleg) wrote in message news:<d7**************************@posting.google. 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***********@burditt.org (Gordon Burditt) wrote in message news:<cg********@library2.airnews.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
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...
13
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...
109
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...
0
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...
9
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...
3
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...
2
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...
1
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...
3
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...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.