[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
SQL Customers and Orders Database question
****** message to minivend-users from Steve Cockwell <stevec@sierra.lazarus.ca> ******
Fellow Minivenders,
I've successfully added a customer and orders database to the system I
am working on and am struggling through the SQL access methods (I really
want to get a good handle on the SQL side of things). I would prefer to
access everything through SQL tags if possible.
Here is my question: I have an AUTO_INCREMENT field in my customer
database for customer_number. Each new customer gets assigned a new
number (obviously). When that customer places an order, I would like
that customer number to be inserted as the second field of the new
record in the order database. The order database would have as it's
first two fields:
order_number INTEGER PRIMARY KEY AUTO_INCREMENT ZEROFILL NOT NULL
customer_number INTEGER ZEROFILL NOT NULL
etc...
So, on the receipt.html page, all I really need to do is the following:
1. Pull the customer number from the customer database by doing a
SELECT WHERE customer_name = '[value fullname]'
2. Insert that value into the order database as the second field while
I am doing my [SQL type=SET etc.] operation.
If some kind soul wouldn't mind giving me some insight on how they think
this should be done, I'd be very happpy. I tried nesting an SQL
statement to pull the field from the customer database inside the SET
operation but I just got syntax errors (likely my fault). I would be
happy with something like:
1. Set minivend variable inside of SQL statement that pulls number from
customer database
2. use [value myvar] in set operation.
It's actually only #1 that I am having trouble with.
Architectural/Procedural comments welcome though as well (except ones
that begin with "don't use SQL tags...")
Thanks!
.src
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list