我的 php 代码有问题,它没有从 mysql 数据库中提取我的表行。这段代码看起来是否正确。
<?php
$host="localhost"; // Host name
$username="username"; // Mysql username
$password="password"; // Mysql password
$db_name="database"; // Database name
$tbl_name="marquee"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Retrieve data from database
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<?php
// Start looping rows in mysql database.
$rows=mysql_fetch_array($result);
?>
test
<? echo $rows['scroll'];
echo $rows['id'];
?>