Jump to content

PHP code example - export table data


Lukael

Recommended Posts

Hello everyone,

 

I have one humble request and I hope someone here will help me.

 

Before I start, I have to say that I'm clueless about PHP and I'm in a little rush, so that's why I don't have a lot time to learn about PHP.

 

My problem is:

 

- I have a IBM DB2 table on one side, and PHP application on other. DB2 table is like a "temporary" table.

 

-  All data from table has to be inserted into PHP  application, which should then send those data to another tables back in DB2, with same types.

 

I'm trying to automatically insert some values made in MS Excel solution via DB2. Values should be inserted into PHP application and saved, so that user can see those entries done. I'm just trying to eliminate double entering of same data from MS Excel. I believe when values are inserted and saved, all datas will be automatically send to another tables - because application allready does that.

 

Table data is: _Date_,_Name_,_Start_Time,_End_Time_ (and PHP application has input fields for that)

 

What I need is just some links to what kind of PHP coding I should use, or maybe even better If someone provides me a simple example. Code should prefferable be generated from a cmd_button in PHP application.

 

I'm sorry in advance If question is stupid, probably only some export command should be done, but I still need an example of PHP code for that.

 

I hope I was clear!

 

Thanks for help !!

Edited by Lukael
Link to comment
Share on other sites

 > I have a IBM DB2 table on one side, and PHP application on other. DB2 table is like a "temporary" table. 

 

Have them on the same machine or on different machines?

 

Normaly you let your PHP application handle database requests (or commands) to your database server, which will reply to this requests.

 

There is a IBM DB2 driver for PDO available: http://php.net/manual/en/ref.pdo-ibm.php

 

One of the links on that page brings you to a first connection example: http://php.net/manual/en/ref.pdo-ibm.connection.php

 

For the rest PDO will work much the same as PDO works for other databases. 

 

Most PDO tutorials will focus on MySql databases.

Link to comment
Share on other sites

Hi Frank,

 

thanks for response.

 

I'm not sure what you meant by this link. As I can see, this is just an example how to connect to database, which is actually quite simmilar to what I had to in VBA + executed a SQL query from cmd_prompt.

 

Normaly you let your PHP application handle database requests (or commands) to your database server, which will reply to this requests.

 

 

So, I have to perform SQL commands once connected to DB, just like in VBA ? And what about inserting data into input fields, aren't those objects in PHP ? Any examples of that ?

Link to comment
Share on other sites

You began with the premise that you have a db2 table and you have a php application.  What IS that php application?  Or did you mis-speak? 

 

I would also add - if you have a task to do and you don't know how to use php, then why don't you use something that you DO know?

Link to comment
Share on other sites

Hi ginerjm,

 

thanks for response. O.K., I will fulfill my question...

 

I'm doing this for school project. I know VBA and HAVE done an Excel VBA solution, which creates CSV file which is imported in DB2 to a table with all data from Excel. That is first and second part of project, which works.

 

Third, and final part is that there is an PHP application or better said information system, to which I don't have access, but wish to show how datas caould be sent to application fields, so I would like to just post an example in my project. That's all.

 

I was hoping just for some example code in PHP. In VBA you would have to write a code for certain ActiveX Control (like Textbox,Checkbox etc.), and assign It a table data from DB2, with SQL import command.

 

I hope this is more clearer. I can also post a screenshot of how aprox. PHP application looks, but I will have to create a sample (with Access?).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.