...

View Full Version : PHP Access / Posting scripting



Gordie
01-05-2006, 07:01 AM
Hey, I just started out with PHP and what not and I was wondering a few things.
My plan is to create a access page where I can sign into my site from any where and post on it. My method was to have the homepage look via PHP for a file on the server and load the contents into that section [an embedded PHP script]. The way I hoped this file could be placed there was by a php page [that requires a password sign-in]that has 2 text fields, one that is for the title, and one for the content. When I click post / save, the title is in one fale and the content is in another. when the homepage loads it loads the title file into an appropiate place, and it loads the content into the appropiate space. The attempt I am going for is quite similar to a blog.
However, I am not sure which scripting commands / methods to use. If anyone could please help me this would be appreciated. I looked at the FAQ tutorial but since I am a PHP n00b I am not positive on how to impliment this..
would something for loading the titles work
<?PHP $title = fopen('title.txt', 'r)' print $title; ?>

rlemon
01-05-2006, 09:36 PM
use a database.

find the database technology you wish to use (i.e mySQL) and create a table on the database. call the table whatever you want (descriptive names are best).

then in php you will need to lookup running query's.

i find the PEAR db object to be fairly simple enough to use.

after connecting to the DB you will run something like this to return all titles.



$sql = "SELECT * FROM table_name ORDER BY id ASC";
$results = $db_object->query($sql);
while($item = $results->fetchRow()){
print $item['title'] . "<br />";
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum