Forum Moderators: open
This is how I set it up:
CREATE TABLE IF NOT EXISTS `albums` (
category varchar(255) NOT NULL,
albumname varchar(50) NOT NULL default '',
description varchar(255) NOT NULL,
visibility tinyint(1) NOT NULL default '1',
username varchar(30) primary key,
time int(11) NOT NULL
);
This is the function that I have so far:
function albumnameTaken($albumname, $username){
if(!get_magic_quotes_gpc()){
$albumname = addslashes($albumname);
$username = addslashes($username);
$q = "SELECT albumname FROM albums WHERE albumname = '$albumname' AND username = '$username'";
$result = mysql_query($q, $this->connection);
return (mysql_numrows($result) > 0);
}
I am not very familiar with MySQL, so I am not sure what is wrong with the query. When I had it set as: "SELECT albumname FROM albums WHERE albumname = '$albumname'" it worked great. But now that I added the rest on it just returns my scripts error array. I was planning on adding all albums from all users collectively to this table. So I need to be able to check whether each specific user already has an album with a specific name.
Any help would be greatly appreciated.