473,327 Members | 2,071 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,327 software developers and data experts.

Relaying messages through php to a html page...

15
What im trying to do is get messages from php script (using a database) to show up on a html page but with a forum type feel to it as in the ability ot delete messages after they are no longer needed. Whats the best way to do this if any?

DD
Aug 19 '08 #1
7 1314
Markus
6,050 Expert 4TB
What have you done? What haven't you done?
Please show what you have already written.
Aug 19 '08 #2
DDragon
15
at the moment i havent got anything other than the html pag i wish to use... im not after someone to do it for me i just need a nudge in the right direction thats all..

just before anyone pips up and goes about security issues its not for use online its for my own computer page..

as i said im just looking for a nudge in the right direction so if anyone can help or point me to a helpful site or anything that would be great..

DD
Aug 20 '08 #3
pbmods
5,821 Expert 4TB
Heya, DD.

Will you have PHP code stored in the database that you need to execute, or do you just need to output HTML?
Aug 20 '08 #4
DDragon
15
Heya, DD.

Will you have PHP code stored in the database that you need to execute, or do you just need to output HTML?
At the present time just out put to HTML and as i said earlier with the ability to delete the message from the html page (like an email inbox type probably best way to put it)

DD
Aug 20 '08 #5
nathj
938 Expert 512MB
Hi there,

So you have information in a table that you want to display, you also want to be able to add, edit and delete is that correct?

If that's correct then I would have a PHP page for each of those major functions, plus one main page that display it all.

On the main page I would use PHP to retrieve the info from the DB and echo out the results as HTML. This page would also include some buttons/links to execute the functions above. On these buttons/links I would have a call to a relevant JS function that would, via AJAX, call the required PHP function. this PHP function would execute the required code and echo the output to a container on the main PHP Page. this would keep you always on the same page without any refreshes.

In summary then I would have:
1. JS function in a separate file that is used to execute the PHP code
2. One main page written in PHP that displays the information and functions
3. One PHP pager per main function that I wish to execute
4. A DB with all the stored data in.

Does that help out? If you need further examples I have plenty as this pretty much how I build most of my sites.

Cheers
nathj
Aug 20 '08 #6
DDragon
15
Any examples would be great to get me going... as im not overly skilled with php right now and any help would be great.

except about the tables i use css to layout things with mine but pretty much you hit the nail on the head Nathj.

Thanks for the help here people.

DD
Aug 20 '08 #7
nathj
938 Expert 512MB
Any examples would be great to get me going... as im not overly skilled with php right now and any help would be great.

except about the tables i use css to layout things with mine but pretty much you hit the nail on the head Nathj.

Thanks for the help here people.

DD
When I mentioned tables I meant as in a database - I never use tables on a website - I hate them, it's css all the way - though css3 promises CSS tables which look interesting.

Anyway I digress. It's examples you are after. Here's a simple code snippet from my code library that will get information from a table and display it as HTML
[PHP]
function __autoload($pcClassName)
{
require_once '../lib/' . $pcClassName . '.php' ;
}

$loDataObject = new dataObject() ;

$lcDisplay = "" ;

$lnPageID = $_GET['page'] ;

$lcSelect =
"SELECT
a.ID, a.menuID, a.title, a.content
FROM tbl_content a
WHERE a.ID = $lnPageID" ;

$laContent = $loDataObject->queryGetData(false, $lcSelect) ;

if($laContent)
{
foreach($laContent as $laContentRow)
{
$lcDisplay .= '<h1>' . $laContentRow['title'] . '</h1>' ;
$lcDisplay .= $laContentRow['content'] ;
}
echo $lcDisplay ;
}
[/PHP]
for information on the dataObject read this article

this code simply gets information from a DB and displays the heading adn the paragraphs. any specific formatting can be done in the field content as this is a longtext field in a MyISAM DB.

As for the SJAX side of things I recommend having a read of the PHP tutorial especially the sections about MySQL and AJAX.

This should get you started, if you get stuck with any specifics as you go give me a shout and I'll do my best to help out.

Cheers
nathj
Aug 20 '08 #8

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

Similar topics

4
by: StinkFinger | last post by:
My IIS / PHP / MySQL and Exchange are on the same box. To allow PHP to send mail I need to add my servers IP to the "Granted" list for the SMTP Virtual Server in Exchange, however, this opens me up...
1
by: Bob Bedford | last post by:
when sending an email from the mail() function I get this message: mail(): SMTP server response: 550 5.7.1 <test@test.com>... Relaying denied. Proper authentication required I did set the...
5
by: Adam | last post by:
Hi, How do i listen for windows messages in c# on compact.net? I have a window containing an instantiation of the HTML viewer control, which is a child of the main form. As the compact...
0
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I have not tried this before. I have been building an ASP.Net 2.0 app for some weeks now and up till now I have not had any problems publishing. I was given a Word doc to include in the app. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.