uShop English (U.S.) for 179!

uStorekeeper English (U.S.) for 149!

 Products
       uTest
       uReserve
       uShop
       uStorekeeper
       uGolf
       uDirectory
       uSignIn
 Tech Support
       Support Policy
       Knowledge Base
            uTest
            uReserve
            uShop
            uStorekeeper
            uGolf
            uDirectory
            uSignIn
       Documentation
       Reference Sites
 Legal
       Software Piracy
       Legal Notices
       Privacy Policy
       Licensing
 Miscellaneous
       Reseller Info
       Contact Us
       Site Map
Integrating with MySQL

Knowledge Base Lobby : uShop Support Conference : Programmer Tips
Oct-22-17 05:48 AM EST
Original Message
Integrating with MySQL
Author Brian Levine on 10-11-2001 at 07:34 (EST)
I know that this thread has existed in the past, but I thought that I'd bring it up again, as the need has arisen.

Does anyone have a good basic example of integrating uShop with MySQL? My goal is to develop an order applet that reads its parameters from a database, and can also disable itself (or display an out of stock message) when quantity on hand in the database is 0.

In short, I'm tired of having to edit HTML pages (and my store has hundreds of 'em) everytime I run out of stock on an item.

Thanks for your help.
E-MAIL AUTHOR | TABLE OF CONTENTS

Table Of Contents
  RE: Integrating with MySQL Joseph Pishgar, 2001-10-11 13:22:43 (1)
  One idea for dynamically defining your uShop applets Christine, 2001-10-11 14:09:46 (2)
            PHP MySQL Suggestion Christine, 2001-10-31 21:09:23 (3)
                 PHP MySQL Suggestion Works! Brian Levine, 2001-11-01 16:34:59 (4)
                      Building on Brian's example David Futcher, 2002-01-21 00:56:31 (5)
                           brians notes? webmissie, 2002-02-14 19:26:42 (6)
                                Integrating uShop with PHP & MySQL - documentation Microburst Support Team, 2002-04-29 14:27:31 (7)
                                     Integrating uShop with PHP & MySQL - documentation Peter Corbello, 2002-08-20 07:03:17 (8)
                                          RE: Integrating uShop with PHP & MySQL - documentation Bill Weiner, 2002-08-21 04:15:15 (9)

Messages In This Discussion
         1. RE: Integrating with MySQL
        Author Joseph Pishgar on 10-11-2001 at 13:22 (EST)
Hello Brian,

We don't have any SQL interfaces or examples of successful inventory tracking handy in the Support Archives currently.
The uShop Developers Guide is quite extensive concerning applets and compilation..

Additionally, if you are going to be developing an interface, we can provide a few pointers to get you started in the right direction.

Regards,
Joseph Pishgar
Microburst Technologies, Inc.
www.uburst.com
TABLE OF CONTENTS
         2. One idea for dynamically defining your uShop applets
        Author Christine on 10-11-2001 at 14:09 (EST)
Do you know anything about PHP? It is an open-source language that can work with a MySQL database. Many web-hosting providers who support MySQL will have PHP installed as well, and there is a good reference site at php.net.

Anyhow, depending on your programming skills, you could consider writing yourself some PHP code that reads your producttable and dynamically populates your applets.

For example here is a loop written in PHP which connects to your MySQL database, accesses your product table looking only for products with a quantityavailable greater than zero, and then only prints out an applet for each of those products. You should also notice that in this example I jump in and out of PHP with the <?php and ?> symbols. FYI caution - this example does not include any error checking/handling:


<?php

// connect to your MySQL database
$db_socket = mysql_connect("yourhost.com","user","password");

// select only products which have a quantity
// available greater than 0 in your database
// (This assumes you have a table which is keeping
// track of your inventory, of course.)
$q = "select * from yourproducttable where qtyavailable > 0";
$row = mysql_db_query("yourdatabasename",$q,$db_socket);

while($row = mysql_fetch_object($q))
{

// here is a snippet of an applet, i left the
// rest of the applet out for brevity and made
// up some field names for your product table
?>

<PARAM NAME="id" VALUE="<?php echo $row->productid;?>">
<PARAM NAME="name" VALUE="<?php echo $row->productname;?>">
<PARAM NAME="description" VALUE="<?php echo $row->productdesc;?>">
<PARAM NAME="option1" VALUE="<?php echo $row->productoption1;?>">
<PARAM NAME="qty" VALUE="1">
<PARAM NAME="price" VALUE="<?php echo $row->price; ?>">


<?php
} // end while loop

?>


By the way, I've also seen this done with ColdFusion and an Access database.

Christine Edmunds
Microburst Technologies Support Team
TABLE OF CONTENTS
                 3. PHP MySQL Suggestion
                Author Christine on 10-31-2001 at 21:09 (EST)
I made a mistake in my example, it should have said:

$q = "select * from yourproducttable where qtyavailable > 0";
$qresult = mysql_db_query("yourdatabasename",$q,$db_socket);

while ($row = mysql_fetch_object($qresult))
{
...


Sorry for the typo!

-- Christine
TABLE OF CONTENTS
                         4. PHP MySQL Suggestion Works!
                        Author Brian Levine on 11-01-2001 at 16:34 (EST)
Wow! This is fabulous! I keep all of the tag info for my catalog in one table, along with image path and size, and using just a few basic page templates, I only have to change the id data in the query for each item. If qty = 0 in the table then it displays the out of stock message instead of the item applet.

Not only will this help me to update my catalog a lot easier, but it makes it simple to add new pages.

You need to include something about this in your docs. Almost all Unix hosts support PHP and MySQL.

Check out this link for a sample page:
http://www.animecollectibles.com/acnew/ac_sm_epfigs.php3
TABLE OF CONTENTS
                                 5. Building on Brian's example
                                Author David Futcher on 01-21-2002 at 00:56 (EST)
Thanks for the tips here on MySql integration. I got a copy of Brian's notes and tips on creating pages which will read from a database to create pages on the fly. It really helped get me going! (I especially appreciate the tip on using MyODBC to link MS Access to MySql!)

I made a couple adjustments to make this implementation work with my site, and I thought I'd run through some of them. You can go to http://www.flagline.com and check out "ART BANNERS" at the bottom to see my implementation. Eventually, we'll get the whole site converted over to MySql, but for now, it's just the Art Banners.

First, I didn't use the linkdefs database for page generation. I created another field for each item that contained keywords so all items matching a keyword query would all show up together.

Second, I also took this opportunity to begin using javascript instead of the Java applets to add items. With a bunch of individual applets on each page, instead of using a dropdown above 6-10 items, I didn't want to wait for all of them to load.

The other problem I ran into was that if a category had a bunch of items, I wanted to be able to have the script automatically limit the number of items on a page to a specified number, and generate links to pages 2,3,4, etc. I finally got all of that figured out, too...

Anyway, I've really enjoyed learning PHP over this process, and I'm starting to see the unlimited integration we could ultimately realize with uShop. Now, to get real time inventory control, we just need somebody working on integrating the checkout process into the database...if you already have, please let me know! Thanks for posting these kind of tips!

Thanks again,

Dave - david@futcher.com
TABLE OF CONTENTS
                                         6. brians notes?
                                        Author webmissie on 02-14-2002 at 19:26 (EST)
Just wondering where you found brians tip and notes. He seems like he and you have it going on but I am not really sure on how to put all the pieces together. I have read all the php manual and the sql manual and tutorials from both but im still not sure how to get my ushop to work with all this. Thanks in advance for any notes or assistance.
TABLE OF CONTENTS
                                                 7. Integrating uShop with PHP & MySQL - documentation
                                                Author Microburst Support Team on 04-29-2002 at 14:27 (EST)
If you are looking for Brian's notes on how he integrated uShop with a MySQL database using PHP, just e-mail us at support@uburst.com and we'll send it out to you. Brian updated this document to include an ASP example on 4/29/02.
TABLE OF CONTENTS
                                                         8. Integrating uShop with PHP & MySQL - documentation
                                                        Author Peter Corbello on 08-20-2002 at 07:03 (EST)
Is it possible for me to get a copy of this documentation

Thanks
PC
TABLE OF CONTENTS
                                                                 9. RE: Integrating uShop with PHP & MySQL - documentation
                                                                Author Bill Weiner on 08-21-2002 at 04:15 (EST)
As mentioned above, just go ahead and send an email to us at support@uburst.com and we'll send you the notes.
TABLE OF CONTENTS

© 2003 Microburst Technologies, Inc.