mikhak Posted March 17, 2015 Share Posted March 17, 2015 Hii have a database like this :database name : linkid username linkterm linkurl1 a google google.com 2 a yahoo yahoo.com3 c google2 google.com4 d ask ask.comi want checking the duplicate links when my user want adding new link . for example if my user want adding the google.com my php codes should printing a error that this link is duplicate links. i have to google.com links in my database i don't have any problem this item but i want don't have any other google.com in " a " user .i wrote this code but not working : $oldlink = mysql_query("SELECT COUNT(linkurl) FROM `link` where `username`=a AND `linkurl`=google.com"); if($oldlink>0){ echo 'duplicate links'; } else{ echo 'links submitted'; } please help me .thank you. Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted March 17, 2015 Solution Share Posted March 17, 2015 "a" and "google.com" in the query need to be inside single quotes SELECT COUNT(linkurl) FROM `link` where `username` = 'a' AND `linkurl` = 'google.com' Quote Link to comment Share on other sites More sharing options...
mikhak Posted March 17, 2015 Author Share Posted March 17, 2015 "a" and "google.com" in the query need to be inside single quotes SELECT COUNT(linkurl) FROM `link` where `username` = 'a' AND `linkurl` = 'google.com' i tested this code but not working too i tested this code in run sql but not working. thank you for helping Quote Link to comment Share on other sites More sharing options...
mikhak Posted March 17, 2015 Author Share Posted March 17, 2015 "a" and "google.com" in the query need to be inside single quotes SELECT COUNT(linkurl) FROM `link` where `username` = 'a' AND `linkurl` = 'google.com' thank you my problem solved . very very thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.