简体   繁体   English

如何从数据库中提取特定值,而不是将其显示在表中,而是显示为纯文本

[英]How to pull a specific value from a database, and display it NOT in a table, but as plain text

So I have a MySQL database, which I am comfortable being able to access using PHP and mysqli. 因此,我有一个MySQL数据库,可以使用PHP和mysqli访问它。 Here is my question: I wanted to display a certain value in a row as text, not in a table, on the front page of my website. 这是我的问题:我想在网站首页上以文本而不是表格的形式连续显示某个值。 Let's say the row's name is FirstName. 假设该行的名称为FirstName。 I wanted to display FirstName like so: 我想这样显示名字:

Hi there, FirstName ! 嗨, FirstName

I wanted to know how I am able to do that. 我想知道我该怎么做。 I think it should be as simple as connecting to the database, requesting data from the specific table, then just using .display[' FirstName '] , however I am unsure if that will actually work... 我认为这应该简单到连接到数据库,从特定表中请求数据,然后仅使用.display[' FirstName '] ,但是我不确定这是否真的有效...

Any suggestions would be appreciated! 任何建议,将不胜感激!

Suppose Imagine This is you structure of homepage.php file 假设想象一下,这是homepage.php文件的结构

   <html>

        <h1> Hi there,

         <?php 

          //fetch the data inside this body of php and store it in variable called $UserName or anything 

           echo $UserName."<br>";

         ?> //end of Php code

        </h1> //end of h1 tag

    </html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM