Jump to content

New Forum user in need of some help please


mat22

Recommended Posts

Hello,

 

First i would like to say hello to everyone, i have visited KillerSites several times in the past since learning PHP about 7 months ago, would like to say thanks to Stefan for the great videos and anyone else who may also be helping with videos etc. :)

 

1) I created a fully pledged member system as a project to help me learn PHP, infact i love it, i built it with security being my top priority and have extended it since and is coming along great.

 

... My question is not directly about PHP itself rather than MySQL. I have a table called userinformation which as you probably guessed contains all the information about my users. Currently there are 17 columns for each user, yes i feel bad about it as from what i have learnt this is really bad practice and should be split up into another table. Basically the reason for this is because the profiles for each of my users are on the same table. I decided i want to split up the profiles for users on a seperate table but althou i have searched and red allot of information online i am not sure exactly the best way to deal with it.

 

I know i need to use a join, thing is althou i have been reading and trying to learn about joins i dont know which one i should use.

 

Secondly is there anything via phpmyadmin that i need to do to join the table or do i just use php to query both tables etc? Currently when a user signs up to my site there is an id field that is auto incremented, this is the primary and unique key.

 

Now my problem is when a new user signs up the id is not known by the script so how do i add the user to the profile section when i wont know the id that was created by mysql? obviously to my knowledge the profile table would have the user id aswell so when querying it is a matter of checking id from userinformation with the id in the profiles table.

 

If anyone could really explain this to me, i have been wanting to tackle this now for months and want to do it before my sites gets busy, i am just scared to do it incase i mess it up. Of course i have XAMPP installed for local testing.

 

2) Currently my website uses Recaptcha which until now has never failed me... i dont mind it, i mean it has audio support for visual impaired and helps digitize books but reading online it seems not very good practice to use captchas althou most places i go use them, personally i dont care if a site has them or not as i understand from a developers point of view why it is implemented into there website. I have been reading about Akismet and it sounds good but not so good. I was thinking about replacing my captchas for this service but wondering what others think i should do use Akismet of stay with Recaptcha. I mean let take for example i implemented it into my site and someone registered and it was suspected spam, would i just not add the user to the database or add them to the database but verify manually? i think the verify manually but again i am not sure if i will be wasting my time when i could be doing other things to enhance my site.

 

Sorry for such a long drag of a post but honestly the 1st question i have is something i been wanting to tackle for some time but am literally scared to even do it. Once i done it once i will use it to it's full advantage and think that was easy but until then i am worried about it. Question 2 is more of an opinion.

 

Thanks for any help/advice you can provide.

 

And thanks for such a great site and extensive amount of useful resources. It has helped me so much in my development.

 

Update

Was also meant to say is there a bug in this forum? Reason is when i click on links i right-click on them to open in a new tab in latest version of firefox but if i right-click on any links on this forum the right-click works the same as the left-click meaning it just loads the page requested instead of asking me to open in new window, tab etc.. It is very annoying lol.

 

Regards,

Mat

Edited by mat22
Link to comment
Share on other sites

To answer your Question1:

 

I didn't hear about many fields being "bad" practice. Maybe it is, but I didn't know about it. Basically it all comes down to "Data Normalisation" and "Entity Declaration" etc etc. It's not so much as about "X number of fields should be in a table", it's more about "Is my data structured well?"

 

Basically, when you have an entity called "User" - the entity will have properties such as "Age", "DOB", "Name", "Username", "Password" etc etc ... Now think about the properties your member has, and see if there's any repetition, like for example "Delivery Address 1", "Delivery Address 2", "Delivery Address 3", "Delivery Address 4" etc etc just as an example. If you have such data, then it's best practice to create a new entity called "User Addresses" which will be related to "userinformation" table with MemberID or whatever your key is.

 

Analyze your data, and see if there's any *need* to create a new entity. If not then just leave it as it is :P

 

Sorry for my bad explanation if you didnt' understand. Good luck.

Link to comment
Share on other sites

Hi,

 

There is no repetition of entries. I just been reading it can take pressure off a table etc. I certainly am no expert but it seems rather logic that it would help splitting profiles on a different table for performance reasons according to everything i have been reading.

 

Thanks for the reply i will still wait to here what others have to say,

 

Thanks

Mat

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...