在PHP代码意外的T中解析错误
这个问题在这里已经有了答案:
请以这种方式尝试你的代码,
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="SELECT id, email FROM users WHERE id = 1";
$result=mysqli_query($con,$sql);
// Associative array
$row=mysqli_fetch_assoc($result);
printf("id = %s (%s)n", $row['id'], gettype($row['id']));
printf("email = %s (%s)n", $row['email'], gettype($row['email']));
// Free result set
mysqli_free_result($result);
mysqli_close($con);
?>
链接地址: http://www.djcxy.com/p/69605.html