我想从数据库表中检索值并在页面的html表中显示它们.我已经搜索了这个,但我找不到答案,虽然这肯定是容易的(这应该是数据库的基础知识).我想我搜索过的词语具有误导性.数据库表名称是票证,它现在有6个字段(submission_id,formID,IP,名称,电子邮件和消息),但应该有另一个名为ticket_number的字段.如何让它在html表中显示db中的所有值,如下所示:
<table border="1">
<tr>
<th>Submission ID</th>
<th>Form ID</th>
<th>IP</th>
<th>Name</th>
<th>E-mail</th>
<th>Message</th>
</tr>
<tr>
<td>123456789</td>
<td>12345</td>
<td>123.555.789</td>
<td>John Johnny</td>
<td>johnny@example.com</td>
<td>This is the message John sent you</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
然后是"约翰"之下的所有其他值.
如果我使用这样的代码:
$update_result = mysqli_query( $link , $sql_update_login ) or die ('Unable to execute query. '. mysqli_error($link));
Run Code Online (Sandbox Code Playgroud)
它是否必须死亡或者您之后可以提出不同的查询?就像将错误日志写入另一个表的预定函数一样?如:
$update_result = mysqli_query( $link , $sql_update_login ) or function('$query, $error);
Run Code Online (Sandbox Code Playgroud)
'或'之后的其他选项有哪些?我没有在文档中找到它,任何线索都表示赞赏.
我有一个包含以下字段的数据库表(ff_projections):
ID Player Position Team Pass_Yds Pass_TDs Int_Thrown Rush_Yds Rush_TDs Rec_Yds Rec_TDs Receptions Fumbles Extra_Pts FG Sacks Int_Caught Def_TD ST_TD Shutouts Overall_Pts Total_Fantasy_Pts
Run Code Online (Sandbox Code Playgroud)
我想要的是显示Position = QB的所有行.但是,只有某些字段会出现在行中.
像这样:
SELECT Player, Team, Pass_Yds, Pass_TDs, Int_Thrown, Rush_Yds, Rush_TDs, Overall_Pts, Total_Fantasy_Pts FROM ff_projections WHERE Position = 'QB';
Run Code Online (Sandbox Code Playgroud)
然后在网页上的表格中显示结果.