Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Database Help Needed


Guest

Recommended Posts

Hi,

 

I am struggling a little bit what i am trying to do is write a page where the user enters some details and it stores it in the database for later retrival on the accounts page and also on the admin section i have worked out some of the page code which i needed to make the page only show when the user is logged in but i cannot get my head round the database functions and the reason it is wrote this way is because i need the form to attach to the customer hence using the customer_id all i would like is for someone to give me a basic idea of how to write the database code and i will work out the rest myself i have been trying for ages and cannot get it to work how i want it to and i can also write my own custom database code but wish to keep within the format of the original program so the page will look like this map.

 

Entry page of home site once signed in.

 

Page link attached to accounts menu where you can view details and also edit and delete.

 

Page link on the admin backend so the store owner can view the details so he knows how to make the item ordered.

 

The items which the store owner is selling is glasses and the form i am after creating is so the customer can enter there prescription details. There is 10 fields to enter in total.

 

I have written the database fields and they are like this.

 

CREATE TABLE IF NOT EXISTS `prescriptions` (
 `customers_id` tinyint(11) NOT NULL,
 `rightsph` decimal(10,2) NOT NULL,
 `rightcyl` decimal(10,2) NOT NULL,
 `rightaxis` decimal(10,2) NOT NULL,
 `rightadd` decimal(10,2) NOT NULL,
 `leftsph` decimal(10,2) NOT NULL,
 `leftcyl` decimal(10,2) NOT NULL,
 `leftaxis` decimal(10,2) NOT NULL,
 `leftadd` decimal(10,2) NOT NULL,
 `extra` varchar(255) NOT NULL,
 `pd` decimal(10,2) NOT NULL,
 PRIMARY KEY  (`customers_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

as you may also note off the code above i am using decimal this is because the field numbers which are going in are things like +8.00 and -8.00

 

The form is pretty straight forward as well just a simple form with add buttons.

 

Hope somebody can help me write this page also just another note is for the page i have used the accounts page as a template and renamed it and added it to the filelist etc etc and also removed all the accounts data so it is a blank canvas of a page it is named prescriptions.php if this makes any difference to how the page works.

 

Thanks for any help that anyone can offer and if someone could write a chunk of code that i can work from i would be most grateful.

Link to comment
Share on other sites

Have toy thought of using the Customer Extra Fields contribution?

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Thanks

 

That was a very useful contribution and i think i will be able to read the code on that now and write what else i need because it is a little bit limited to just title and entry and i need to add an image and help description to enable the form to be filled.

 

Thanks for all you help if i need any more info i know where to come for some good advice.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...