Zen Cart Logo
Forums / General Questions / Accessing a table from another site

Accessing a table from another site

Locked

Views: 991

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
28 May 2008, 10:53 PM
#1
bluecrystal avatar

bluecrystal

New Zenner

Join Date:
Jun 2007
Posts:
2
Plugin Contributions:
0

Accessing a table from another site

Hi,

I would like to update the orders_products table from another system.
For this I will start a new script in the zen cart environment and I need to know how to connect to the database so I can use SQl to update the table. I am thinking there has to be some script somewhere that does that and I just need to call it. Any help would appreciated. I am new to Zen cart but I know PHP and MYSQL.

I would have to think that that this has been asked before but I can't find it.

Thanks

29 May 2008, 10:10 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Accessing a table from another site

I'm not sure why you're asking what you're asking.
If you're familiar with PHP and MySQL, then I'm sure you're not asking "how do I make a database connection in PHP to MySQL", nor are you asking "how do I access the particular table".

Plus, I don't understand why you'd be "updating" the orders_products table from a remote system ... That table should really only be "read" once the order is placed ... why would you be changing which products were in a certain order?

So ... I think the "answer" to whatever your situation is ... is rather nebulous without you being more clear about what you're trying to accomplish and why.

As to there being some sort of remote-access API to alter data that shouldn't be altered, no, that doesn't exist.

30 May 2008, 4:48 AM
#3
bluecrystal avatar

bluecrystal

New Zenner

Join Date:
Jun 2007
Posts:
2
Plugin Contributions:
0

Re: Accessing a table from another site

Thanks for taking the time to address my question I figured out waht I was looking but since you took the time to try to help out I will explain what I am doing .

I use Zen Cart to sale software. The software runs on web sites.

I am doing a rather simple license control system.

I am adding two columns to the product_orders table. One of them will be a license number and the other one will be a domain name
The buyer of the software will be given the license number at purchase time.

On the client's website, an install program will execute a REST CALL that will start an script on the website where I have Zen Cart installed. This script is the one that needs to access products_orders and update the product_orders table with the domain name where the product is being installed.

I found out that I need to have the following lines at the beginning of my script to then be able to get to the table:

include 'includes/application_top.php';
mysql_select_db( DB_DATABASE , $db );

These two lines answer my question and the table is being updated now