Pulling info from MySql database HTML page

Codes here !

Moderators: macek, egami, gesf

boardmania
New php-forum User
New php-forum User
Posts: 5
Joined: Fri Nov 08, 2002 10:08 pm

Pulling info from MySql database HTML page

Postby boardmania » Tue Nov 12, 2002 7:46 pm

I have being trying to learn PHP and Mysql.... I do know how to pull my data into a xxx.php file so it can be viewed in a web browser.....What I would like to do is have a web page which is built in HTML code and have a simple layer or table that displays the data in mysql I want.. Currently this is what I can do.... http://www.teamlord.net/testnews.php ..But I dont want to have to open another page to view "the news"...I just want to post it in a table or separate layer on the home page which is in HTML http://www.teamlord.net ....Do appreciate the help..

Elena Mitovska
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Nov 12, 2002 12:11 pm
Location: Ukraine
Contact:

Postby Elena Mitovska » Tue Nov 12, 2002 11:16 pm

if you need to display data's from php file on HTML page, you can use frame or iframe elements.
I prefer iframe as it is can be made invisible on page, so I load php file in there and after put data from iframe in any place on HTML page I need.
For example:
you insert iframe tag somewhere in the bottom of you HML page:

<iframe cols=10 rows=10 style="display:'none'" src="xxx.php">

After htML page os loaded, iframe will be filled with data from yuor xxx.php file. Onyuor hTML page in any place you want, define <DIV id="html_news_div"><DIV>
In xxx.php file you can enclose all data in :

<DIV id="news_div> ....your table with news.....</DIV>
in the end of xxx.php file add such rows:

<Script>
top.document.all['html_news_div'].innerHTML=document.all['news_div'].innerHTML;
</script>

So conent of DIV from xxx.php file will be put in DIV on hTML page.
You can easy change content of news div on HTML page, just loading different php files into iframe and exchanging innerHTML between div from file and on page.
To load different files into iframe you need to asign "SRC" attribute of iframe in script: document.all['myIframe'].src="other_file.php"

Of course there are many different ways to change data in dofferent parts of hTML page without reloading it. but I used to this way of doing it, and I don't see why stop using it :)

boardmania
New php-forum User
New php-forum User
Posts: 5
Joined: Fri Nov 08, 2002 10:08 pm

Cool

Postby boardmania » Wed Nov 13, 2002 9:57 am

THX.......that helps.....cause I didnt want to rename the HTML file to php unless it was necessary


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest