PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 25th, 2002, 04:16 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
mySQL multiple index'es

Is there anyway to have multiple indexes in a table.
The reason Im asking is because I want users to able to log in using username and not index number. I want to use both username and at the moment I have made some of the code based on ID number (row number).

This does not work:
SELECT * FROM user_info WHERE username=$username

This is the table:
CREATE TABLE user_info (
id int(11) NOT NULL auto_increment,
firstname varchar(25) default NULL,
lastname varchar(20) default NULL,
email varchar(35) default NULL,
credits int(11) NOT NULL default '500',
username varchar(25) NOT NULL default '',
password varchar(10) NOT NULL default '',
url varchar(65) default NULL,
sitetitle varchar(45) NOT NULL default '',
description varchar(45) default NULL,
progr_related tinyint(4) NOT NULL default '0',
banner tinyint(4) default NULL,
counter tinyint(4) default NULL,
PRIMARY KEY (id),
UNIQUE KEY id (id),
FULLTEXT KEY email (email),
FULLTEXT KEY email_2 (email),
FULLTEXT KEY email_3 (email),
KEY username (username)
)

Reply With Quote
  #2  
Old August 25th, 2002, 10:13 AM
Gipz Gipz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Stockholm, Sweden
Posts: 98 Gipz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to Gipz
RE: mySQL multiple index'es

Hi!

I think you confuse index with primary key. Indexes is used to speed up searches in columns. The primary key is used to get a specific id number for each row.

Are you familiar with the "unsigned" command? I would also recommend you using "UNIQUE(column)" instead of key.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > mySQL multiple index'es


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway