If the values in $array
are strings, then your query has invalid syntax. Consider this:
$array = ['foo', 'bar'];
$q = "SELECT * FROM xx WHERE url IN (".implode(',',$array).") ORDER BY id DESC";
The resulting query will be:
SELECT * FROM xx WHERE url IN (foo, bar) ORDER BY id DESC
Whereas you need:
SELECT * FROM xx WHERE url IN ("foo", "bar") ORDER BY id DESC
Change the implode to something like this:
$q = "SELECT * FROM xx WHERE url IN ('".implode("','",$array)."') ORDER BY id DESC";
Note the single quotes I added, now the resulting query will contain quoted strings in the IN clause:
SELECT * FROM xx WHERE url IN ('foo', 'bar') ORDER BY id DESC
Having said this, concatenating strings into a query still leaves you vulnerable to SQL injection. You should consider learning about prepared statements, and start using them