ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
RewriteCond %{QUERY_STRING} action=page [NC]
RewriteCond %{QUERY_STRING} id=(\d+) [NC]
RewriteRule .* /page/%1/? [R=301,L]
select 1+t1.n as number, t2.num
from
(select 0 n union select 1 union select 2 union select 3 union select 4
union select 5 union select 6 union select 7 union select 8 union select 9 ) t1
left join rate t2 on t1.n=t2.num and t2.usersid=1
order by number
если = null тогда
...
иначе
....