关于以下代码,我有几个问题:
// Create a new MySQL connection, inserting a host, username, passord, and database you connecting to
$conn = new mysqli('xxx', 'xxx', 'xxx',);
if(!$conn) {
die('Connection Failed: ' . $conn->error());
}
// Create and execute a MySQL query
$sql = "SELECT artist_name FROM artists";
$result = $conn->query($sql);
// Loop through the returned data and output it
while($row = $result->fetch_assoc()) {
printf(
"Artist: %s<br />", $row['artist_name'], "<br />",
"Profile: %s<br />", $row['artist_dob'], "<br />",
"Date of Birth: %s<br />", $row['artist_profile'], "<br />",
"Password: %s<br />", $row['artist_password'], "<br />"
);
}
// Free memory associated with the query
$result->close();
// Close connection
$conn->close();
如何分配artist_dob
,artist_profile
和artist_password
返回给浏览器?
声明$conn->error()
是什么意思?我不明白这个->
标志是做什么的。