Please help me out...Its like this. I have tags table. The structure is given below.
Code:
CREATE TABLE `tags` (
`tid` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`cid` INT NOT NULL ,
`name` VARCHAR( 250 ) NOT NULL
) ENGINE = InnoDB;
Code:
TID CID Name 1 1 Wordpress 2 1 Facebook 3 1 Facebook - This should not come!
Code:
if(mysql_num_rows("SELECT * FROM `tags` WHERE `cid` = ".$lcid." AND `name` = '".$ltag."';") == 0)
if(mysql_query("INSERT INTO `tags` ( `tid` , `cid` , `name` ) VALUES ( NULL , '".$lcid."', '".trim($ltag)."')"))
echo '<br>Successfully added '.$ltag.' to '.$_POST['flname'].'.';
else
echo '<br>Cannot add '.$ltag.' to '.$_POST['flname'].'. Reason: '.mysql_error();
else
echo '<br>Cannot add '.$ltag.' to '.$_POST['flname'].'. Reason: Tag already exists!';
Regards,
Praveen Kumar,
CEO & Managing Director,
PraveenTech Research Labs
Research Labs »« University
Blog »« TechVidhya »« Forums »« Projects

