Jump to content

checking if url exists in database.


xwishmasterx

Recommended Posts

Best practice for this is to use a SELECT COUNT() query like:

 

SELECT COUNT(id) AS num FROM websites WHERE url = '$url'

 

There will be one row returned with just one field called 'num'.

 

Using a normal SELECT or SELECT * is inefficient because you are asking the MySQL server to pull out a dataset which you don't even need, you only want to know how many rows there are.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.