Im not even sure if this is possible (Im new to php)
Anyway, what I want to do is this:
mysql_query("SELECT * FROM user_table WHERE concat(username,'@',domain)='$username' LIMIT=1");
Ok, so the $username is an email address that is submitted by a user to search the database to check that they exist. In the user_table usernames are not stored in a single column, they are stored in several with the domain and the actual username being separate.
for example username could be bob and the domain could be website.com.au
Then when the user wants to search for that user the type in bob@website.com.au
This goes to the query above.
So, should it work or not? If not how can I make this work or what suggestions do you have for me?
probably worded the question slightly wrong.
Anyway this is what I have done
"SELECT * FROM virtual_user WHERE concat_ws('@',username,domain)='$username'"I no longer need to use the LIMIT=1, I probably never needed to as all results in the table are individual, so it will always only return a limit of 1 or nothing at all.
It isn’t slow in my opinion, but then again Im not really sure what to compare it to. We have about 7000+ records it sorts through so yeah. Is there anyway to get it to tell you how long the query took to complete?
I would like to put both the username and domain into just a single indexed field but its for a postfix mail server and I’m not allowed or game to play with the queries it uses. Especially not on a functioning server that actually handles mail.