Q: How to assign php variables to html?

Source: Internet
Author: User
Q: How can I assign a value to the php variable in html? I am definitely a newbie and have a starting point of 0. come and help me and use it on your own. & Lt; div & nbsp; align = "left" & gt; & nbsp; & lt; h1 & nbsp; align = "center" & gt; & amp; nbsp; & lt; New Q: how to assign the php variable to html?
I am definitely a Cainiao. it's a starting point. come and help me with it. you can use it on your own.


Put a variable $ data here



... Connect to the database
$ Data = xxx
?>


How to assign the results of the subsequent database to him.

------ Solution --------------------

... Connect to the database
$ Data = xxx
?>






Let's use a smarty program and a template to separate it.
------ Solution --------------------

... Connect to the database
$ Result = mysql_query ($ SQL );
?>


While ($ data = mysql_fetch_assoc ($ res )){
?>
Put a variable here
}
?>





The approximate format is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.