4

how to select 主页报修上广告

$sql = "SELECT text,pic FROM newstable where type='在线报修上广告' order by id desc limit 0,1";

but you may find the return value is null

But i try to use this

$sql = "SELECT text,pic FROM newstable where type=N'在线报修上广告' order by id desc limit 0,1";

there is N before '在线报修上广告' ------->>>>>but it works....what's the meaning of this 'N'!!

000
  • 41
  • 5

1 Answers1

2

What is the meaning of the prefix N in T-SQL statements?

It#s declaring your varchar as nvarchar which is using a unicode encoding page. Otherwise it will be converted to the default encoding page of your database. Basically it's prefered to use only varchar when intended (like email addresses)

Pwnstar
  • 2,333
  • 2
  • 29
  • 52