我正在尝试选择一张桌子而且我不知道我做错了什么:
$result = mysql_query('SELECT * FROM sfat WHERE done="0" LIMIT 0,10');
$row = mysql_fetch_array($result)
$url = $row["web"];
答案 0 :(得分:1)
使用
while ($row = mysql_fetch_array($result) ) {
$url = $row["web"];
echo $url;
}
代替
$row = mysql_fetch_array($result)
$url = $row["web"];
因为您的查询表明您最多需要10行。但是你的代码只显示第一个。
答案 1 :(得分:0)
以下示例将用于创建数据库
<?php
$con=mysqli_connect("hostname","username","password");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Create database
$sql="CREATE DATABASE my_db";
if (mysqli_query($con,$sql))
{
echo "Database my_db created successfully";
}
else
{
echo "Error creating database: " . mysqli_error($con);
}
?>