Jump to content

Setting up new table


Dada78

Recommended Posts

I have set up some new columns and I just what to make sure I set it up correctly or if their is something I need to change that would make it easier. Also I need to know how to insert a picture into the database. The table is for this form....

 

http://www.mesquitechristmas.com/local/submit.php

 

Now you will notice in the table below ID email and password, those are inserted when the user registers then once they are registered they are able to use the submit form which will submit their information hopefully in the same row with the registration information.

 

here is the database

 

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(4) NOT NULL auto_increment,
  `email` varchar(65) NOT NULL default '',
  `password` varchar(65) NOT NULL default '',
  `displayname` varchar(40) NOT NULL,
  `displaytype` varchar(40) NOT NULL,
  `description` longtext NOT NULL,
  `address` varchar(50) NOT NULL,
  `address2` varchar(50) NOT NULL,
  `city` varchar(10) NOT NULL,
  `state` varchar(5) NOT NULL,
  `postal` int(5) NOT NULL,
  `country` varchar(15) NOT NULL,
  `website` varchar(40) NOT NULL,
  `imagefile` varchar(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=33 ;

 

Is this set up correctly for the form I listed above?

 

-Thanks

 

 

Link to comment
Share on other sites

Only for US users? What's imagefile?

 

Yes it is only for U.S. users and also only for people in my city and state. It is going to be a section within my Christmas Display web site where other residents around the city can post their displays for other to find during the Christmas season, but just for my city. The imagefile is the the name of the form for uploading an image from the form but I wasn't sure what to use or how to store and image so I just set it at varchar 1 until I could figure out how to learn how to do that.

 

Any suggestions or ideas?

Link to comment
Share on other sites

I would allow for storage for most of the fields, no need to cut it close for a few bytes -- otherwise you'll have to deal with truncation issues/warnings.  As for the images, you should store in on the file system, and record a relative path in the db.

Link to comment
Share on other sites

I would allow for storage for most of the fields, no need to cut it close for a few bytes -- otherwise you'll have to deal with truncation issues/warnings.

 

I am not sure I am following you, can you explain a little more about what you mean?

 

As for the images, you should store in on the file system, and record a relative path in the db.

 

That is how I want to do it, just store the image in a folder and have the DB store the URL and being to call it from their. How do I go about doing that. Is their anywhere you can point to read about this or explain this to me further?

 

-Thanks

Link to comment
Share on other sites

I would allow for storage for most of the fields, no need to cut it close for a few bytes -- otherwise you'll have to deal with truncation issues/warnings.

 

I am not sure I am following you, can you explain a little more about what you mean?

 

Your field lengths seems very strict... why not be more lenient?

 

As for the images, you should store in on the file system, and record a relative path in the db.

 

That is how I want to do it, just store the image in a folder and have the DB store the URL and being to call it from their. How do I go about doing that. Is their anywhere you can point to read about this or explain this to me further?

 

-Thanks

Go about doyoing what? Uploading via PHP? You'll need to post that question in the appropriate forum.

Link to comment
Share on other sites

Your field lengths seems very strict... why not be more lenient?

 

 

Which ones are you referring to? Some of the are set to the length of the data that will be inputting. Like postal is a drop down box where they make their choice so it only needs to be 5. Pretty much City, State, Postal, Country are all set values. I don't even know why I need country now that I think of it.

Link to comment
Share on other sites

Your field lengths seems very strict... why not be more lenient?

 

 

Which ones are you referring to? Some of the are set to the length of the data that will be inputting. Like postal is a drop down box where they make their choice so it only needs to be 5. Pretty much City, State, Postal, Country are all set values. I don't even know why I need country now that I think of it.

Perhaps, but for the other fields, it seems rather short...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.