开发者

get the field names straight from the db table [closed]

开发者 https://www.devze.com 2023-04-02 11:31 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reas开发者_如何转开发onably answered in its current for
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reas开发者_如何转开发onably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I’m building a database driven website using WAMP

I have database with table called userinfo with the following field names DateTime DomainName ComputerName UserName NetworkSettings.

And I have a PHP script with a HTML table

echo "<div id='tableheading'>\n";
echo "<table class='data' border='1'align='center'>\n";
echo "<tr>\n";

echo "<th> DateTime </th>
echo "<th> DomainName </th>
echo "<th> ComputerName </th>
echo "<th> UserName </th>
echo "<th> NetworkSettings </th>

How do I get the field names straight from the database?


As you are using WAMP, I assume you're talking about MySQL. Have a look at mysqli_result::fetch_fields().


I'd advise against that

  1. It's better to give field names plain lowercase names
  2. HTML table headers often mismatch db table field names
  3. Typing field names by hand is not as hard as you imagine
0

精彩评论

暂无评论...
验证码 换一张
取 消