gpt4 book ai didi

html - 我很难为我的 body 命名

转载 作者:行者123 更新时间:2023-11-28 13:03:25 26 4
gpt4 key购买 nike

我试图让标题出现在这个页面的正文中。好吧,出于某种原因,当我使用 center 标签时,标题没有出现,我也不知道为什么。有人可以告诉我中心标签有什么问题吗?

<!DOCTYPE HTML>
<html>
<head>
<title><?php echo'giggity'?></title>
</head>
<body>
<?php
$Title="The Title of my page";
?>
<center><?php echo $Title;?></center>
<?php
$con = mysqli_connect('localhost', 'username', 'password','Employees');
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// $db = mysqli_select_db($con,'Employees');
$sql = "select * from Employ";
$query = mysqli_query($con,$sql);


echo "<table border ='1' style='height:90%;width:90%; position: absolute; top: 0; bottom: 0; left: 0; right: 0;border:1px solid' BGCOLOR='00FF00'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Meetings_Today</th>
<th>Sales</th>
<th>Comments</th>
</tr>";

//now read and display the entire row of a table one by one looping through it.
//to loop we are using While condition here
while( $row = mysqli_fetch_array($query) )
{
echo "<tr><td>". $row['Firstname']. "</td>";
echo "<td>". $row['Lastname']. "</td>";
echo "<td>". $row['Meetings']. "</td>";
echo "<td>". $row['Sales']. "</td>";
echo "<td>". $row['Comments']. "</td></tr>";
}

echo "</table>";
mysqli_close($con);

?>
</body>
</html>

最佳答案

以下代码对我来说工作正常(参见 http://www.floris.us/SO/title.php)

<!DOCTYPE HTML>
<html>
<head>
<title><?php echo'giggity'?></title>
</head>
<body>
<?php
$Title="The Title of my page";
?>
<center><?php echo $Title;?></center>
</body>
</html>

这正是您粘贴的代码(相同的空格等),但在打印标题后关闭 body 和 html 标签。

我建议您从这里开始,然后添加代码“直到它中断”。

好的 - 我自己添加了代码。按照您布置表格的方式,它一直延伸到页面顶部,因此“位于标题的顶部”。将 top 更改为为标题留出空间的内容 - 或者将标题放在表格中......

可能的解决方案:

echo "<table border ='1' style='height:90%;width:90%; position: absolute; top: 50; bottom: 0; left: 0; right: 0;border:1px solid' BGCOLOR='00FF00'>

我把它用于 http://www.floris.us/SO/title2.php

源代码:

<!DOCTYPE HTML>
<html>
<head>
<title><?php echo'giggity'?></title>
</head>
<body>
<?php
$Title="The Title of my page";
?>
<center><?php echo $Title;?></center>
<?php
echo "<table border ='1' style='height:90%;width:90%; position: absolute; top: 50; bottom: 0; left: 0; right: 0;border:1px solid' BGCOLOR='00FF00'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Meetings_Today</th>
<th>Sales</th>
<th>Comments</th>
</tr>";

// replace db access with a single line of text:

echo "<tr><td>". "John". "</td>";
echo "<td>". "Smith". "</td>";
echo "<td>". "Pocahontas". "</td>";
echo "<td>". "Firewater". "</td>";
echo "<td>". "English". "</td></tr>";

echo "</table>";

?>
</body>
</html>

关于html - 我很难为我的 body 命名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20875247/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com