Changing text from database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kedora19
Forum Commoner
Posts: 34
Joined: Tue Apr 07, 2009 10:05 am

Changing text from database

Post by kedora19 »

Hey,

I'm making a website for my band. What I'm needing is to be able to change the body text (not the whole page), I have coded a script that can make a post for our blog. I was wondering how (if i put all the body text for the other pages in to a database) I could take the text out of the database and show it in a text box, that i can edit then press submit and it would change the text in the database.

Then when you view the page, the changes would be made. This would make it easier so i don't have to change the php page, and then upload the file. I can do everything from the site.

OH YES!! i forgot to tell you that i DO have a login script that i'm using so that no one but THE BAND can change anything.

THANKS IN ADVANCE
PS: hopefully you understand. if you don't, ask me questions i'm always open.
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Changing text from database

Post by yacahuma »

i think you are talking about having an admin page. The admin page will allow you to edit certain parts of your web site. I will do something really simple,
like having a key-value table. Then your admin will allow you to edit those keys. Then in your page you will show the values.
this is non working code:

Code: Select all

 
<?
$news = get_from_sql( select VALUE FROM TABLE WHERE KEY='NEWS');
?>
 
The news are
<?= $news?>
 
It is very simple but you need to know how to read and write to a database. I suggest looking at some tutorials.
kedora19
Forum Commoner
Posts: 34
Joined: Tue Apr 07, 2009 10:05 am

Re: Changing text from database

Post by kedora19 »

yacahuma wrote:i think you are talking about having an admin page. The admin page will allow you to edit certain parts of your web site. I will do something really simple,
like having a key-value table. Then your admin will allow you to edit those keys. Then in your page you will show the values.
this is non working code:

Code: Select all

 
<?
$news = get_from_sql( select VALUE FROM TABLE WHERE KEY='NEWS');
?>
 
The news are
<?= $news?>
 
It is very simple but you need to know how to read and write to a database. I suggest looking at some tutorials.

OH!!! i get it, thanks. Yeah i'll look at some tutorials.
Post Reply