Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Checking a Column

Codes here !

Moderators: macek, egami, gesf

Checking a Column

Postby Xerpher » Sat Sep 07, 2002 6:58 am

I made a script that will add new users to my db but I first want it to check the entire column to see if the username exists. Is there any specific function that would be good or should I just make a loop to go through each row?
Xerpher
New php-forum User
New php-forum User
 
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada

Postby Jay » Sun Sep 08, 2002 1:46 am

select count(*) from usersTable where username='$user'
Jay
 

Postby Jay » Sun Sep 15, 2002 5:28 pm

I wouldn't use the address as a way of checking the data, since addresses can be miss-spelled etc. It would have to be exactly right for a match to occur. Better to pick one thing that won't change (like an email address) and use that to search for a matching record
Jay
 


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.