PHP链接本地mysql数据库操作实例

";   /* Close the connection 关闭连接*/
 }
  
 mysqli_query($link,'set names utf8');    //解决中文乱码的问题
 
 if ($result = mysqli_query($link, 'SELECT ID,NAME,AGE FROM userinfo')) 
 {  
	echo('ID  NAME  AGE '). "
"; /* Fetch the results of the query 返回查询的结果 */ while( $row = mysqli_fetch_assoc($result) ) { echo $row['ID'], " ", $row['NAME'], " ", $row['AGE'], "
"; // printf("%s (%s) ", $row['id'],$row['class'], $row['scores']); } /* Destroy the result set and free the memory used for it 结束查询释放内存 */ mysqli_free_result($result); } /* Close the connection 关闭连接*/ mysqli_close($link); ?>
PHP链接本地mysql数据库操作实例_第1张图片

你可能感兴趣的:(后端)