朋友们,我是创建数据库的初学者,我正在使用 xampp 创建数据库
<html>
<body>
<marquee behavior="alternate">welcome</marquee>
</body>
</html>
<?php
$username = "root";
$password = "root123";
$hostname = "localhost";
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
?>
<?php
$selected = mysql_select_db("missensencemuttation",$dbhandle)
or die("Could not select missensencemuttation");
?>
<?php
$result = mysql_query("SELECT * FROM `primary_data` LIMIT 0, 30");
($row=mysql_fetch_array($result));
{
echo "disease_name:".$row{'disease_name'}." gene_name:".$row{'gene_name'};
}
?>enter code here
<?php
mysql_close($dbhandle);
?>
这就是我为将我的数据库与 php 连接所做的事情
但结果我只能看到我的表的第一行,其中有 10 行。但是当我用来连接它们时,我只能看到我的第一行。在我的 php
任何人都可以帮助我在 php 中连接我的所有数据吗?
<html>
<body>
<marquee behavior="alternate">welcome to the database</marquee>
<table border="3" align="center">
<tr><th>disase_name</th><th>gene_name</th></tr>
<?php
$username = "root";
$password = "2991";
$hostname = "localhost";
$dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
$selected = mysql_select_db("disease",$dbhandle) or die("Could not select disease");
$result = mysql_query("SELECT * FROM `primary_data` LIMIT 0, 30");
while($row = mysql_fetch_array($result))
{
echo "<tr><td>".$row['disease_name']."</td><td>".$row['gene_name']."</td> </tr>";
}
mysql_close($dbhandle);
?>
</table>
</body>
</html>