473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to display data in a PHP variable at a HTML page?

I have created a php page to retrieve data from a database. Now I want to display the data that I retried at a HTML page. How I can do that?
Dec 25 '10 #1
5 2081
Thew
69
Expand|Select|Wrap|Line Numbers
  1. echo $data;
Dec 25 '10 #2
AutumnsDecay
170 100+
It depends on how you want to show your data.

Let's assume we have a database called 'users', and we want to pull and show ALL the data in that table. The 'users' table has 3 columns:

1) id
2) username
3) email

Our query would look like:

Expand|Select|Wrap|Line Numbers
  1. $query = "SELECT * FROM users ORDER BY id ASC";
  2.  
Now, because we potentially have a long list of information, we can just spit it out on the screen, as that would be nearly impossible to sort through. So, we perform a 'while loop' to keep our data sort.

Expand|Select|Wrap|Line Numbers
  1. $result = mysql_query($query);
  2. while ($row = mysql_fetch_assoc($result)){
  3.     print 'Id: ' . $row['id'] . '<br />';
  4.     print 'Username: ' . $row['username'] . '<br />';
  5.     print 'Email: ' . $row['email'] . '<br />';
  6.     print 'END OF CURRENT USER INFORMATION <br /><br />';
  7. }
  8.  
Here's what that would look like:

Id: 1
Username: jappleseed
Email: jappleseed25@hotmail.com
END OF CURRENT USER INFORMATION

Id: 2
Username: HonestAbe
Email: alincoln@gmail.com
END OF CURRENT USER INFORMATION

etc.
Dec 25 '10 #3
The codes you are given above is in a .php file. And we get the final out put in a .php file. But I need to know is how to transfer those outputs in to a .html file.
Dec 25 '10 #4
Dormilich
8,658 Expert Mod 8TB
is it necessary to put it in an .html file? if the .php file has the correct content, it is no different from a .html file.
Dec 25 '10 #5
OK I understood it is not possible to do that. Thanks
Dec 25 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: vishal | last post by:
i am making an application. the user can give description and that description is stored in database and then the description is shown on html page. suppose the user has written "<b>hello</b>"...
4
by: dmiller23462 | last post by:
I'm trying to create a submission page for users to request PC/LAN Access....If they select "Yes" in the field asking about if they need Non Standard Software, I want several other HTML fields to...
4
by: jrefactors | last post by:
How to extract data from html page? For example, if i want to get the information of weather (http://weather.yahoo.com/forecast/USCA1005.html) and put in my web page. Is it possible to do that? ...
2
by: Joe | last post by:
Hi, I have an asp.net script that connects to MS Access database and displays data in a table. For some reason I am do not know how to display data say in ascending order of column1. I have...
3
by: Al | last post by:
Hi Many thanks in advacne, does anyone know how to display contenet of a Html page on a VB form.? can this be display in a RichRextBox? if yet how.. Many thank Al
8
by: Jeff | last post by:
I asked this question sometime ago. some help was given, but A.) i didn't understand the help and B.) I can't find the post. i am looking for a way to take a table of stats on an HTML page, and...
3
by: karthigaj | last post by:
Hi, Happy new Year... i need to retrieve the data from the web server which is developed using HTML and i need to process those data in c but i should not use any CGIs. Can anybody help me...
5
by: teddarr | last post by:
I have this product catalog. I am to scroll through the catalog on the HTML page and use data from the XML page to display the different products with a picture of each. I have the data and the...
10
hsn
by: hsn | last post by:
hey everyone i am currntly working on a project. for a function that i want to create there are too many methods to solve it. one of these methods that i am thinking of is to write a javascript...
5
by: Andelys | last post by:
Hey I have to get some data from a html page into an other page. I know how to get the data by a simple AJAX request, but I don't know to find the data. The data i need to find is in a table,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.