I don't seem to be able to get my SELECT statement to work.
This is the table:
CREATE TABLE clients(
user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
email VARCHAR (70) NOT NULL,
mobile_number int(11) NOT NULL,
UNIQUE KEY (email)
The Select Query
SELECT user_id FROM clients WHERE email='[email protected]';
Whenever I try using this SELECT statement from mysqlADMIN it returns
null; this happens even when I enter an email address that I know is in the database.
I would really appreciate some advice on where I am going wrong.
Try the statement without the "WHERE" clause. If it returns the entire table you have narrowed it down to an error in your "email" string.
If it returns nothing and you know there is data in this table then check your connection string and make sure you are using the correct DB.
I think there is some error in your SQL create statement. You should make the unique key to which you have applied auto increment. In this case the database will give an error.
Please try the following creation statement
CREATE TABLE clients( user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, email VARCHAR (70) NOT NULL, mobile_number int(11) NOT NULL );