content managment question

Soldato
Joined
1 Feb 2006
Posts
8,188
Hi, Im just a noob at php and am trying to write some code to edit items in a database. I have a page which pulls out news items from a db. To edit or update these items I have come up with the following workflow:

- Recall article from database
- Create temp variables and assign then to database results
- Set up the data entry form
- Assign the temp variables into the form (i.e. popular form with existing news item)
- Run update query

Apologies if this doesn't make sense but I'm just curious to know if i am thinking this through the proper way! I don't have any code for this yet but I can post some once I get started.
 

Voo

Voo

Associate
Joined
6 Jul 2006
Posts
113
Location
Hull, East Yorks
To edit an item in the database you would do the following:

List items in database.
Choose one of the items to edit.
Create a form with the fields populated with the items details.
Edit the fields.
Update back to database.

I can give you some code to get you started if you wish?
 
Soldato
OP
Joined
1 Feb 2006
Posts
8,188
Voo said:
To edit an item in the database you would do the following:

List items in database.
Choose one of the items to edit.
Create a form with the fields populated with the items details.
Edit the fields.
Update back to database.

I can give you some code to get you started if you wish?

Cool, I think we are on the same wavelength near enough! I have written a page that dynamically creates a link on each article called 'edit'. When this is clicked it will link to the page with the webform using a GET link. I might get back to you on the code if I get stuck. If you have any code for creating and populating RSS feeds from a database Id take it right now! Or any AJAX validation scripts?!

thanks for your help
 
Soldato
OP
Joined
1 Feb 2006
Posts
8,188
cheers mate, appreciate it. Now that I know where I'm going with the update stuff I should make some progress in the next few days. Need to sort out all my validation still and a few other modules like file uploads and dynamic link generation but thats for another day!
 
Soldato
OP
Joined
1 Feb 2006
Posts
8,188
one more question for the same cms. I will have to have a form with up to 6 checkboxes, of which any combinations can be selected. How would I best store these results in the database? Only way I can think of is to have 6 fields with a boolean type (or ENUM i think it is in MySQL). Any suggestions?
 

Voo

Voo

Associate
Joined
6 Jul 2006
Posts
113
Location
Hull, East Yorks
Yeh, for each record you could put that into the database so that if 1,3,4 and 5 are checked, it puts them as 1 in the database and a 0 for 2 and 6.

That make sense?
 
Back
Top Bottom