URL: http://www.uburst.com/cgi-bin/dcforum/dcboard.cgi
Forum: ushop_database_ideas
Thread Number: 1
[ Go back to previous page ]

Original Message
"Interfacing uShop with MySQL"

Posted by Microburst Support Team [support@uburst.com] on at 09:00 PM
If you are tired of maintaining hundreds of product pages that contain uShop applets, you might consider putting your products in a database, and then dynamically generating your HTML pages containing uShop applets. If you know something about programming, you might be interested in getting familiar with PHP, an open-source language that can work with a MySQL database. Most web-hosting providers who support MySQL will have PHP installed as well for their customers to use freely. There is a good reference site at http://www.php.net to help you get started.

Depending on your programming skills, you could consider writing yourself some PHP code that reads your "producttable" and then dynamically populates product pages and your uShop applet options.

For example here is a loop written in PHP which connects to a MySQL database, accesses a "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 notice that in this example I jump in and out of PHP with the symbols. FYI caution - this example does not include any error checking/handling:


// 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";
$qresult = mysql_db_query("yourdatabasename",$q,$db_socket);

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

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







} // end while loop

?>

I am just suggesting one free solution, but there are no doubt other ways of interfacing a database with HTML pages containing uShop applets. I've also seen this done with ColdFusion and an Access database.

Christine Edmunds
Microburst Technologies Support Team


Table of contents

Messages in this discussion
"PHP MySQL Suggestion Works!"
Posted by Brian Levine [blevine@cfl.rr.com] on at 09:03 PM
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

(this posting was copied from Brian's original post at this link: http://www.uburst.com/dcforum/ushop_prog_tips/101.html )


"PHP Sample Code"
Posted by Microburst Technologies Support Team [support@uburst.com] on at 07:21 PM
If you try to view this message thread using Netscape, you might not be able to see the sample code in the above posting.

If you do not have another browser available, e-mail us at support@uburst.com and we can e-mail you some sample PHP code.


"Getting Started with PHP"
Posted by Microburst Technologies Support Team [support@uburst.com] on at 07:35 PM
One important point I forgot to mention, if you include PHP code in a web page, you will need to change the extension of that web page to be either

.php
.php3
.php4
or
.phtml

depending on the version of PHP that is installed on your server.


"DB uShop with MySQL/Php ..."
Posted by James - Hampton Development [mail@hamptonplace.com] on at 09:34 PM
Greetings,
I developed a complete admin for mysql and php which interface with uShop. Sorry, not for sale, only for licensed installs for domain sites, single users. Not for resale. It can be done very easily, just takes time to configure a scheme that will satisfy many different merchants. It's really the only way to do it, even for small sites.

Example Sites:
http://www.bagshop.com/
http://www.dutchcreekfoods.com/carlisle/
http://www.mytruckstore.com/
http://www.stonebarnfurnishings.com/
http://www.reggaecd.com/
(Currently 6,800+ CD Titles)

More can be found from our site, working pretty much the same:
http://www.hamptonplace.com/

I have them set up with cross selling options, several dynamic options, availability options, pass protected wholesale as well as retail output, specials posted to front page, tons more. Here is an old db demo template (inactive), several new options have been added.

http://www.hamptonplace.com/db_adddemo.php3

It's been a process from input of several merchants needs over time.

I've been using uShop for quite some time, it's the perfect marriage for database setup, merchants have freedom to admin completely themselves with many options.

Bill Weiner has also been a big support..;) These folks are tops!

Thanks,
James B.
Hampton Development



"msaccess example?"
Posted by oliver [oliverg1@hotmail.com] on at 07:03 PM
I would appreciate if you could explain how to do this using access with one of the codepieces that I have downloaded with Ushop? I have the database working in FrontPage. At the moment it is giving me an ASP table as output. ... Many thanks!

"Integrating w/Access"
Posted by Brian Levine [blevine@.cfl.rr.com] on at 08:52 AM
Just to clarify...you are running on a Windows NT server and wish to use Access as your server-side database (I could debate the wisdom of this for a while,but I'll refrain). You want to create web pages that will integrate with this database, and you plan on using Active Server Pages to accomplish this.

Is this correct?


"Integrating with access"
Posted by oliver [oliverg1@hotmail.com] on at 01:06 PM
Yup! In South Africa we do not have much choice...
The server has frontpage extensions. NO PHP or unix etc. I have one of your examples downloaded. I obviously want to replace the TAG hell with refrence to something that I can use. I will ALLWAYS be downloading the full database file so SQL is easy. This at the moment is downloaded s ASP with your java tag replicated on each line - More than sufficient for my purposes. The prob is that I now need access to the item data on the left line in ASP or someother way?

"ASP to Access"
Posted by Brian Levine [blevine@cfl.rr.com] on at 12:32 PM
Well, I'm no ASP programmer, but I think that the same structure I used would apply: You're going to need an ODBC connection to your database, and then you'll have to supply the ASP code to access the DB from your pages. Look at this PHP code snippet from my example:

// $q - sql string
// $idno - id of item in database
// $dbs - the database socket
// $cs - colspan value (defaults to 1)
$q = "select * from catalogue where Id = '" . $idno . "'";
$db = mysql_select_db("my_odbc_conn",$dbs);
$result = mysql_query($q);
$row = mysql_fetch_object($result);

The technique is fairly straightforward:
- connect to the database
- query the database

Your challange is to figure out how to do this using ASP, and then to teach the rest of us

I would like to see the good folks at uBurst to add all this info to the uShop documentation (along with the sample code). I think that a lot more people would use this approach if they knew that they could do it fairly easily (and if you have more than 10 pages of catalog items, you're crazy not to). Moreover, its the only way I know of to integrate uShop into an Inventory/Invoicing system.