I want to know which one better? I have some PHP scripts and wonder if I can copy and paste them into HTML? Can you give at least the best solution for a posting a webpages that includes database of clients's e-mail address and home address including phone number? I got some money and ready to order a web page host service.
Which webpages format is better? PHP or HTML?
All web pages are in HTML format - that's the language of the web. PHP is a way of adding dynamic content to HTML, so PHP pages are better in that they can do more.
You can paste PHP scripts into a web page. The scripts have to be marked off by %26lt;?php at the start and ?%26gt; at the end. On most systems you also have to name your file with a .php extension so the server will know to look for the code.
Which webpages format is better? PHP or HTML?
HTML is a lot simpler and easier to use, not to mention PHP can have a lot of loopholes that require patches on the code. And yes the two can be intertwined. Just like how you have a HTML site with a forum, which is php.
Reply:You use PHP in conjuntion with HTML. You use HTML to format and display your content, PHP for any coding (data retrieval, in your case). You paste the PHP code into your HTML pages like:
%26lt;?php
// PHP Code here
?%26gt;
%26lt;!-- rest of your html --%26gt;
If you're going to be displaying clients' personal data, make sure you have a login page so the data can't be displayed to anyone else.
Reply:HTML is the design. PhP is for data, not design. If you are going to use PhP, the page needs to have a .php extension, not .htm.
I use a lot of PhP on my website. I use it to get info from a database and then display it. Kinda like this...
//Get info from database
$sql=("SELECT * FROM tablename");
$query=mysql_query($sql);
while($row=mysql_fetch_array)
{
//Display info
%26lt;p%26gt;$row[Name]%26lt;/p%26gt;
}
This will display all the 'Names' from the database.
If you will be displaying a lot of data that changes, names added, removed, edited, etc, then it would be better to use PhP because you would not have to wade through the page to find the name.
If you need more help, contact me at http://www.yuchniuk.com
Reply:HTML and PHP are two different languages. They have different uses. HTML is a client side language which will render a static page on the client computer. PHP is a server side scripting language which can deliver dynamic web content to a client computer. PHP is a language which can communicate with the server to provide connections to the database, a mail server and host of other services to deliver content to the web page.
One is neither better or worse than the other... they server different functions.
Most web sites or hosting services will be able to render html pages. If you want to use PHP scripts, you would need to make sure that the hosting service supports PHP. PHP is one of the languages of choice to connect with a database [such as mysql] to store things such as email addresses or phone numbers.
You can not normally just cut and paste a PHP script into an HTML document. You need to have a .php page for the page to render the PHP script on the webpage.
没有评论:
发表评论