473,379 Members | 1,220 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,379 software developers and data experts.

Using PHP & MySQL to display web pages

AF
I am a real novice to php and MySQL, with about a week's worth of
reading and self tutoring. I have an urgent need to publish a
database of information and need some guidance on how to do this.

This question might be more suited to a MySQL newsgroup, but since php
and MySQL seem to have become almost married to one another, and since
getting the data out and displaying it is where my problem seems to
lie, I thought I would start with this php group.

The problem is I can not figure out how to put information into a
MySQL database and get it out and correctly dislay it for the web.
More correctly I have two types of data I need to get in and out.

1. I have some web page content, not inlcuding borders, that is in
html format. So I have tried saving the html code, which looks
exactly like the code when you "view source" on a web page, into MySQL
and getting it out. I can get it out, but I have not figured out how
to make it act like html, i.e. to be interpreted by the browsers.
Instead it comes out looking exactly like html code. It is not being
interperted by the browser.

2. I would prefe instead of typing in html code for the content of a
page to type in instead the text, tables, lists, etc. Here is where
my problem lies, how do I input to MySQL relatively simple web pages
that may have a table, a list, some links, a picture?

3. How do I call up and use the data from MySQL an dget this to
display for the web?

By the way, I have been learning css, so I would like to use this if
possible. If not, i.e. if the formating mechanism for getting content
into a database precludes having it formattted by css on the
publication sie, then that is ok. I can live with that.

Thanks for any help

Cheers to everyone,

Al

http://www.discountdrivingschool.com
Jul 17 '05 #1
7 3344
I noticed that Message-ID: <bj********************************@4ax.com>
from AF contained the following:
1. I have some web page content, not inlcuding borders, that is in
html format. So I have tried saving the html code, which looks
exactly like the code when you "view source" on a web page, into MySQL
and getting it out. I can get it out, but I have not figured out how
to make it act like html, i.e. to be interpreted by the browsers.
Instead it comes out looking exactly like html code. It is not being
interperted by the browser.
It most certainly should be. I'm afraid we need code to see what you
are doing wrong. Are you saving the file with the extension .php?
2. I would prefe instead of typing in html code for the content of a
page to type in instead the text, tables, lists, etc. Here is where
my problem lies, how do I input to MySQL relatively simple web pages
that may have a table, a list, some links, a picture?


Usually PHP is used to populate an existing table (or generate a dynamic
table) from data stored in a database. Pages can consist of html parts
and PHP parts but when the server has finished the PHP is processed and
only the output gets sent to the browser.

e.g.

<html>
<body>
<?php
print "Hello World";
?>
</body>
</html>

is sent to the browser as

<html>
<body>
Hello World
</body>
</html>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
AF <bs********@NOSPAMYahoo.com> wrote in
news:bj********************************@4ax.com:
I am a real novice to php and MySQL, with about a week's worth of
reading and self tutoring. I have an urgent need to publish a
database of information and need some guidance on how to do this.


I am quite new myself. php.net has alot of tutorials. mysql really isnt
that hard, except for the admin stuff, which I think is a pain. But
phpmyadmin helps alot, and its free. Installing it takes a little care...
its not like installing photoshop. But follow the instructions and it will
work. Later, you can write your own simple HTML form pages with php so you
can do simple editing of tables.

You do have apache, mysql, & php I assume.

And yes there is alot of info in the SQL newsgroup.
Jul 17 '05 #3
AF
On Mon, 10 May 2004 00:24:03 +0100, Geoff Berrow
<bl******@ckdog.co.uk> wrote:

snip..
Usually PHP is used to populate an existing table (or generate a dynamic
table) from data stored in a database. Pages can consist of html parts
and PHP parts but when the server has finished the PHP is processed and
only the output gets sent to the browser.


Let me give you an example of what I want to do:

here is a url:

http://www.improvingyourhome.com/homestore.nsf/32a793ea58ba3df585256e5c005f5f66/f348bc1ba98fa17685256e59005cbc58!OpenDocument

If you go look at it, you will see a list in the middle of the page.

Here is the page without the <li>

Abundant Earth offers a wide variety of environmentally sensitive
products and services for people who want to make a difference in the
world.

Departments include:

Air Purification
Bags & Packs
Beds & Bedding
Candles - Holders
Cards - Journals
Children - Fun
Cleaning
Coffees & Teas
Energy Savings & Conservation
Gifts & Crafts
Health Wellness
Hemp & More
Home Furnishing
Jewelry
Kitchen & Bath
Lawn & Garden
Personal Care
Pets & Wildlife
Platform Beds
Recycled Items
Vitamins & Supplements
T-Shirts
Water Purification
The list starts at "Air Puritfication".

Now I think I can solve my other problem in my original post. I am
sure there is something I have done wrong.

But getting a page's content that contains a list like the above or a
table is not shown, or at least I can't find it.

Imagine for example you were to create a simple Word doc that
contained a list and a table, and now you want to show that Word doc
on the web as an html page. But you want the contents of the Word doc
to be in a field and then have that field displayed.

Is there something like a "rich text field" in MySQL and can php
display this field in html?
Cheers to everyone,

Al

http://www.discountdrivingschool.com
Jul 17 '05 #4
In article <4i********************************@4ax.com>, AF wrote:
Let me give you an example of what I want to do:

But getting a page's content that contains a list like the above or a
table is not shown, or at least I can't find it.


If i understand you right: You have a page in your database. That page
itself has a list that should be built dynamically.

In that case you might want to have a look at the eval function in the
manual.
--
http://home.mysth.be/~timvw
Jul 17 '05 #5
In message <4i********************************@4ax.com>, AF
<bs********@NOSPAMYahoo.com> writes
<snip>

Is there something like a "rich text field" in MySQL and can php
display this field in html?
There are a variety of text fields in MySQL, but none of them are the
kind of 'rich text' field you want. You would have to populate them
with the correct HTML to produce the result you wanted in the browser.

See:
http://dev.mysql.com/doc/mysql/en/Column_types.html
http://dev.mysql.com/doc/mysql/en/String_types.html
http://dev.mysql.com/doc/mysql/en/CHAR.html
http://dev.mysql.com/doc/mysql/en/BLOB.html
I would expect your PHP page to generate some of the required HTML and
extract some parts from the database, so to generate a list it would
contain:
<ul><li>1st tiem</li><li>second item</li></ul>

And you would have to type in (or otherwise generate) the correct tags
yourself.

At the end of the day the PHP script has to generate the complete HTML
that you would write to produce the desired page. It can do that by a
mixture of bits of HTML in the PHP script outside the <? ?> sections
(e.g. the sections that contain the PHP code), bits of HTML that are
printed as literals inside the <? ?> sections, and bits of HTML that are
extracted from a database again inside the <? ?> sections.

Cheers to everyone,

Al

http://www.discountdrivingschool.com


--
Five Cats
Email to: cats_spam at uk2 dot net
Jul 17 '05 #6
AF
On Mon, 10 May 2004 08:56:20 +0100, Five Cats <ca*******@[127.0.0.1]>
wrote:

snip...

There are a variety of text fields in MySQL, but none of them are the
kind of 'rich text' field you want. You would have to populate them
with the correct HTML to produce the result you wanted in the browser.


You have an accurate picture of what I want to do. How do really big
sites, like About.com, input all of their articles? I can see how to
handle pictures, but what about tables and lists that are part of my
page content?

Do they use languages that do have this kind of field? Or do they
just input the code for the whole content?

In the example I posted:

"Abundant Earth offers a wide variety of environmentally sensitive
products and services for people who want to make a difference in the
world.

Departments include:

Air Purification
Bags & Packs
Beds & Bedding
Candles - Holders
Cards - Journals
Children - Fun
Cleaning "

is there a way to post this with a pseudo html, something like this:

"Abundant Earth offers a wide variety of environmentally sensitive
products and services for people who want to make a difference in the
world.

Departments include:

<li>Air Purification
<li>Bags & Packs
<li>Beds & Bedding
<li>Candles - Holders
<li>Cards - Journals
<li>Children - Fun
<li>Cleaning "

The point being that a paragraph needs no code to be rendered
properly, but the list of items does.

This would be doable from an input point of view. But if I had to add
the <br>'s and other code in order to render the whole page that would
be very inefficient.

What about all of these content management systems I see? They have
fields that allow bold, italics, centering, fonts changes in size and
color. How do they handle the code?

Do they convert the field I would input into html and then save it?

Thanks to everyone that has posted.

Cheers to everyone,

Al

http://www.discountdrivingschool.com
Jul 17 '05 #7
In message <ej********************************@4ax.com>, AF
<bs********@NOSPAMYahoo.com> writes
On Mon, 10 May 2004 08:56:20 +0100, Five Cats <ca*******@[127.0.0.1]>
wrote:

snip...
There are a variety of text fields in MySQL, but none of them are the
kind of 'rich text' field you want. You would have to populate them
with the correct HTML to produce the result you wanted in the browser.


You have an accurate picture of what I want to do. How do really big
sites, like About.com, input all of their articles?


I can't say as I can only see what they produce.
I can see how to
handle pictures, but what about tables and lists that are part of my
page content?

Do they use languages that do have this kind of field? Or do they
just input the code for the whole content?

In the example I posted:

"Abundant Earth offers a wide variety of environmentally sensitive
products and services for people who want to make a difference in the
world.

Departments include:

Air Purification
Bags & Packs
Beds & Bedding
Candles - Holders
Cards - Journals
Children - Fun
Cleaning "

is there a way to post this with a pseudo html, something like this:

"Abundant Earth offers a wide variety of environmentally sensitive
products and services for people who want to make a difference in the
world.

Departments include:

<li>Air Purification
<li>Bags & Packs
<li>Beds & Bedding
<li>Candles - Holders
<li>Cards - Journals
<li>Children - Fun
<li>Cleaning "

The point being that a paragraph needs no code to be rendered
properly,
Possibly - but see the comment on CSS below.
but the list of items does.

This would be doable from an input point of view. But if I had to add
the <br>'s and other code in order to render the whole page that would
be very inefficient. What <br> would that be?

Departments include:
<ul>
<li>Air purification</li>
etc.
</ul>

The tags have to be there in the final analysis.

What about all of these content management systems I see? They have
fields that allow bold, italics, centering, fonts changes in size and
color. How do they handle the code?

Do they convert the field I would input into html and then save it?
Have never seen or used one so cannot comment, but I'm sure that style
sheets are part of it as well so that it's easy to alter the style of a
given type of element without having to alter all the pages or whatever.

They might be storing the stuff as XML and doing things to it on it's
way out.

There are lots and lots of ways of doing things, so as the questions get
more & more detailed it gets harder & harder to provide answers as what
comes into my head are more & more questions.... ;-)

Thanks to everyone that has posted.

Cheers to everyone,

Al

http://www.discountdrivingschool.com


--
Five Cats
Email to: cats_spam at uk2 dot net
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Japhy | last post by:
Hello, I'm am pulling data from a mysql db and want to use the data to populate a <ul. Here are relavent parts of my code : $wohdate = mysql_result($wohRS,$wohndx,woh_date); $woh_display...
2
by: davidgordon | last post by:
Hi, This seems impossible to me. I've read tons of posts, but I just cannot fathom it out. I have a form for our range of products. There are four fields (text) which need to be filled with an...
17
by: MeerkatInFrance | last post by:
There comes a time when you know you are not going to be able to work something out yourself, however hard you try. I have reached that moment. I have a master page and a slave page (or whatever...
1
by: Jneedles | last post by:
Relatively new to PHP and MySQL... I've got a field named live_date as a date type field within my DB. I need to split the display table into M-F weeks, projected out from todays date based on...
1
by: nsteele84 | last post by:
Hi I have just set up my apache webserver with PHP4, openssl, modssl, mysql etc. Everything works fine on the non ssl side but when I try to open a php page on the ssl side the browser displays...
0
by: jediknight | last post by:
I have a simple project where there is a master page called MasterPage.master and some webforms which are content pages. I also have a usercontrol which is a simple calendar control popup. The...
1
osward
by: osward | last post by:
Hi all, I got code over the net for paging mysql table, it provides Prev pages Next link at the bottom of the table. However, I have a pretty large table to display (average over 400+ rows). Even...
6
by: mike | last post by:
hi. trying to set up a new site with some interactivity between the pages. need a coder to set up the initial user database where visitors create their personal accounts. i'm a green...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.