• Resolved mikhak

    (@mikhak)


    Hi

    i have a database like this :

    database name : link

    id username linkterm linkurl

    1 [COLOR=”#FF0000″]a[/COLOR] google google.com

    2 [COLOR=”#FF0000″]a [/COLOR] yahoo yahoo.com

    3 [COLOR=”#0000FF”]c[/COLOR] google2 google.com

    4 d ask ask.com

    i 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 :

    [code]
    $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';
    }
    [/code]

    please help me .

    thank you.

Viewing 1 replies (of 1 total)
  • Thread Starter mikhak

    (@mikhak)

    “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’

Viewing 1 replies (of 1 total)
  • The topic ‘how i can checking the duplicate links with php and mysql ?’ is closed to new replies.