question about modifying something

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
Nicole
Forum Newbie
Posts: 22
Joined: Thu Oct 26, 2006 7:47 am

question about modifying something

Post by Nicole »

Hi, I need to modify something that is pulled from a database. I know how to pull the item out of the database with php and then have the field all set and ready to go in a form field.

Can I use the same exact php with additions added to it send the item back to the database again, after it is modified?

In other words can you use a select query and an insert query with the same php code?

Thank you very much.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I believe you're more referring to an UPDATE query, but the principle is the same. So the answer to your question is yes.
richmix
Forum Commoner
Posts: 31
Joined: Fri Dec 22, 2006 5:21 am

Re: question about modifying something

Post by richmix »

Nicole wrote:Hi, I need to modify something that is pulled from a database. I know how to pull the item out of the database with php and then have the field all set and ready to go in a form field.

Can I use the same exact php with additions added to it send the item back to the database again, after it is modified?

In other words can you use a select query and an insert query with the same php code?

Thank you very much.
If I understand what you're trying to do correctly, you can just pull the info from your database with the SELECT query, and use the information from the SELECT query to populate the form fields. Then just make the action of the form point to a PHP file with an UPDATE query that simply utilizes the variables from the form. After the UPDATE query, just return the user to the form, and the fields should update to reflect the new information automatically, if you set it up right.
Nicole
Forum Newbie
Posts: 22
Joined: Thu Oct 26, 2006 7:47 am

Post by Nicole »

You are soooo right!!!! I didn't even need an update command, I just sent it to
a separate modify field for the database. Every thing has been such a struggle that I tried, didn't think it would be that easy. Thanks!!
Post Reply