best method for doing mysql update

Codes here !

Moderators: macek, egami, gesf

Post Reply
guitarizmo

best method for doing mysql update

Post by guitarizmo » Mon Feb 20, 2012 8:35 pm

I have 3 pages. Basically the first (menu1) page pulls columns from my mysql menu table and creates them as hyperlinks for selection by user. When selected, it sends the table key to my second page (menu2), I run a query on this data and populate some text boxes with existing database information. I want the user to able to make modifications to menu data, which I want to then update that row of data in SQL. The first page works fine and the mysql select query runs and pulls the correct data. The update query also works fine when I plug in values manually. I need to know how to send the modified text on the second page, which represent changes to the restaurant menu, to the update query. I'm struggling to share PHP variables with HTML forms.

From the first form, I send the table key menu_id. I do a $Get on this and use it for my select query. I will also need this value to not change, so I can use it in my update query. The other 4 fields, menu_item, item_description, item_price and item_category. get changed or remain the same based on user selected manipulation. Can someone please help me understand, best method.

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: best method for doing mysql update

Post by egami » Tue Feb 21, 2012 5:24 am

You should probably look into using SESSIONS if you want variables to go from one script to another.

User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: best method for doing mysql update

Post by freshnet » Fri May 04, 2012 12:02 pm

echo back the query to your browser, then try running it and see if it updates correctly. If you're not getting any error the problem is likely in the code you're using for the update.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest