Note that there are some explanatory texts on larger screens.

plurals
  1. POChecking if a url is already submitted in database in php
    primarykey
    data
    text
    <p>What i need get done is checking if a url is already submitted in database using php.</p> <p>I have a database table where i store URLS submitted by users. But i want to check if the urls are already submitted or not in the database before inserting it to the database. For example, URLS like <a href="http://www.example.com" rel="nofollow noreferrer">http://www.example.com</a>, <a href="http://www.example.com/" rel="nofollow noreferrer">http://www.example.com/</a>, <a href="http://example.com" rel="nofollow noreferrer">http://example.com</a> and <a href="http://example.com/" rel="nofollow noreferrer">http://example.com/</a> should return false if any one of them is already inserted in database as they all are same urls. I think we can get this done by using regular expression.But i am a little weak in regex so need your help. thank you</p> <p><strong>Edited</strong></p> <p>Hello, let's assume if the urls are in array not database just to make clear. I know about the unique key and matching url with the result from database. But here i have a </p> <p>different question if you look at it carefully.</p> <p>$urls = array('<a href="http://www.example.com/newpage.html" rel="nofollow noreferrer">http://www.example.com/newpage.html</a>', '<a href="http://www.example.com/newpage.html" rel="nofollow noreferrer">http://www.example.com/newpage.html</a>');</p> <p>case A user submits a url. suppose <a href="http://example.com/newpage.html" rel="nofollow noreferrer">http://example.com/newpage.html</a></p> <p>Now as a url <a href="http://www.example.com/newpage.html" rel="nofollow noreferrer">http://www.example.com/newpage.html</a> is available in $urls array and <a href="http://www.example.com/newpage.html" rel="nofollow noreferrer">http://www.example.com/newpage.html</a> and <a href="http://example.com/newpage.html(userinput" rel="nofollow noreferrer">http://example.com/newpage.html(userinput</a> without www) are same page so i need a function to check it and return false if the url is available in the array. I hope i clarified my self now.</p> <p>So it's not checking a domain or making unique key in mysql table for url field i think so far. I think we need to use regExp for it. Any help?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload