Dot in the username is creating problems.

Thread Solved

Join Date: May 2008
Posts: 69
Reputation: Kavitha Butchi is an unknown quantity at this point 
Solved Threads: 4
Kavitha Butchi Kavitha Butchi is offline Offline
Junior Poster in Training

Dot in the username is creating problems.

 
0
  #1
Sep 7th, 2008
Hello all,

I have this strange problem.
During registration if user chooses to have '.' in his username, eg: sam.leo then i am getting this wierd problem .

-respective tables with the given username are not getting created in the Database.

Everything is working fine if usernames are having no special characters.
Other than asking users not to use any special characters, how can I solve this!!

Can someone tell me why is this happening and how to get rid off this

Thankyou all in advance.
Last edited by Kavitha Butchi; Sep 7th, 2008 at 9:46 pm.
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,138
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 130
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Dot in the username is creating problems.

 
1
  #2
Sep 7th, 2008
We would need to see your code / mysql queries where the rows are being added to the table.
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 69
Reputation: Kavitha Butchi is an unknown quantity at this point 
Solved Threads: 4
Kavitha Butchi Kavitha Butchi is offline Offline
Junior Poster in Training

Re: Dot in the username is creating problems.

 
0
  #3
Sep 7th, 2008
Thankyou for the quick reply.

Here is the related code.

  1.  
  2. //Code for creating a table --[not wokring when dot is used in username]
  3.  
  4. mysql_connect(" ---") ;
  5. mysql_select_db("---");
  6.  
  7. mysql_query("CREATE TABLE $username(
  8. id INT NOT NULL AUTO_INCREMENT,
  9. PRIMARY KEY(id),
  10. name VARCHAR(30),
  11. order VARCHAR(990),
  12. date datetime NOT NULL default '0000-00-00 00:00:00')");
  13.  
  14.  
  15. mysql_connect("---") ;
  16. mysql_select_db("---");
  17.  
  18.  
  19.  
  20. //creating table another table[-not working when dot is used in username--]
  21.  
  22. mysql_connect("------") ;
  23. mysql_select_db("-----");
  24.  
  25. mysql_query("CREATE TABLE $displayname(
  26. id INT NOT NULL AUTO_INCREMENT,
  27. PRIMARY KEY(id),
  28. likeditem VARCHAR(30))")
  29. ;


-> Tables in a database are not getting created when a dot is used in username.
-> But records are getting created in a table(already created tables which are same for all users)

Everything is working fine when dot is not used.

using=> Godaddy hosting connection, mysql databases.

Please let me know if i need to post anyother details.
Last edited by Kavitha Butchi; Sep 7th, 2008 at 10:28 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,233
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 169
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Dot in the username is creating problems.

 
1
  #4
Sep 7th, 2008
i personally don't recommend making a new table for every user. it may be organized but is difficult to deal with. i would make a users table, then any other tables you would need and you ids to reference info in different tables.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 600
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 126
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Practically a Master Poster

Re: Dot in the username is creating problems.

 
0
  #5
Sep 7th, 2008
I agree with keith. What happens when you have 100 users? You are going to have 100 user tables with one row of data in each. Bad design. All of this could be done with 1-3 properly normalized tables.
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 69
Reputation: Kavitha Butchi is an unknown quantity at this point 
Solved Threads: 4
Kavitha Butchi Kavitha Butchi is offline Offline
Junior Poster in Training

Re: Dot in the username is creating problems.

 
0
  #6
Sep 8th, 2008
Originally Posted by buddylee17 View Post
I agree with keith. What happens when you have 100 users? You are going to have 100 user tables with one row of data in each. Bad design. All of this could be done with 1-3 properly normalized tables.
Thankyou fr your time buddylee17.
The individual tables created in my database are used to keep track of all the chat conversations of the user.
I considered that option long before while creating tables with the usernames but was taken back with the idea that it may be well organised rather than creating feilds or records in a single table.
But now seems like there is no other option left and hence shall think abt modifying the structure.

Can someone tell me is there any other solution for this problem?!
Also,
Which one is better?I mean which one is of low burden to the database.

-100 feilds in a table.
-100 records in a table.
-100 tables in a database.

Thankyou all in advance.
Last edited by Kavitha Butchi; Sep 8th, 2008 at 10:25 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 189
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

Re: Dot in the username is creating problems.

 
1
  #7
Sep 8th, 2008
Having a dot in the username will not work because most SQL languages use the dot as a relation. So an username like "Jesus.Christ" will try to create a table called 'Christ" in the schema "Jesus". As there is a very low probability of the schema being actually "Jesus", the table creation will fail.
To check, try using your schema.something as username. For example, if your schema is called "MySchema", create an user as "MySchema.NewUser". This should work and create a table called "NewUser" (NOT MySchema.NewUser) in the schema "MySchema".
As for the rest of your question, having a table for each user is not really a good idea. Having a table with 100 fields is even worse. If you need to look up a non-indexed field, the DB Engine will have to read through all 100 fields.
Best solution = 100 records in 1 table, properly indexed. As far as practicable, try normalising the tables so that data-scans are faster.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 69
Reputation: Kavitha Butchi is an unknown quantity at this point 
Solved Threads: 4
Kavitha Butchi Kavitha Butchi is offline Offline
Junior Poster in Training

Re: Dot in the username is creating problems.

 
0
  #8
Sep 8th, 2008
Got it!!
Thanks a Ton Aparnesh for the detailed explaination.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 752 | Replies: 7
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC