简体   繁体   中英

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. 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. I wanted to display FirstName like so:

Hi there, 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...

Any suggestions would be appreciated!

Suppose Imagine This is you structure of homepage.php file

   <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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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