Mysql连接数据库用php mysql fetch [复制]

$result = mysql_query("SELECT name FROM internet_shop");
while($row=mysql_fetch_assoc($result))

Its shows errors mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in

Databsename:piashhas_piash

One table in database: internet_shop

Runs well in local host Xampp but when on server it shows error can anyone help thanks

</div>

Alter the query line to

$result = mysql_query("SELECT name FROM internet_shop") or exit(mysql_error());

Is an error displayed? As ccKep stated, MySQL is deprecated; consider MySQLi.

$connectionId = mysqli_connect($host,$user,$pass) or exit(mysqli_connect_error());
mysqli_select_db($connectionId, "piashhas_piash") or exit(mysqli_error($connectionId));
$result = mysqli_query($connectionId, "SELECT `name` FROM `internet_shop`");
while($row=mysqli_fetch_assoc($result))