|
-
Edit external text + update database
Hey, i'm fairly beginner to php, but i'm pretty good at flash scripting...
Basically, i've created a shop in flash, and it all works fine, creating invoices with php by sending all the variables to the php file.
What i'd like some help on is a php script to store all the invoice details in a my_sql database... Here's the variables i'd like to store
Order Number
Name
order0 ---
order1 | - this is an array, each number contains the
order2 | details for each item purchased
order3 ---
address
phone number
e-mail address
In the long run i'd like to be able to search the database, and bring up old orders, by just typing in the order number.
The flash file generates a random number as the order number, e.g. 1233-32423-4234234, now the chances of the same number coming up twice are about 1 in 10000000000000000 or something, but i'd like the flash file to check if the number has already been used (by searching the database) and if it has, generate a new one.
I don't know if any of this is possible, but i'm pretty sure it will be...
If anyone could help with any part of it, that would be greatly appreciated
Thanks
-
Hi,
mysql can add auto_increment numbers - this is common way for uniqueness.
You probably do not want to put an array into a table schema unless you are absolutely sure no order has more items that your layout
A better apporach would be two tables - the first one with order number, address, shipping details, and the second one with order number / item pairs (so a typical order generates several entries in that table)
In yet another step you would add a third table with item number and item details, and reduce the second table to just order number / item number pairs
Musicman
-
Okay, thanks... the thing i'm most stuck on though is how to get the script to write to the sql database.
The flash actionscript passes the variables and their values into the php script, and i need to know how to get that script to write these values into the database for storage.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|