Hello.
I made a table like this
CREATE TABLE `test` (
`id` int(11) NOT NULL auto_increment,
`image` varchar(20) NOT NULL,
`user` varchar(20) NOT NULL,
PRIMARY KEY (`avatar_head_id`)
)
and let's say that I inserted these values:
INSERT INTO `test` (`id`, `image`, `user`) VALUES
(1, 'test1.jpg', ''),
(2, 'test2.jpg', ''),
(3, 'test3.jpg', ''),
(4, 'image1.jpg', '5'),
(5, 'image2.jpg', '1');
Now, I would like to select all rows from table where user is nothing AND user is some variable i get from other side. For example:
SELECT * FROM test,users WHERE users.id = $sessionid AND test.id = users.id AND test.id = ''
(test.user corresponds to specific user.id)
I know that example above will not work so I wonder how to do this?
Thanks!