Forum Moderators: open

Message Too Old, No Replies

Update individual entries with values from another table

how to pass variables in mysql and php

         

selomelo

11:52 am on May 8, 2006 (gmt 0)

10+ Year Member



I know that it may be easy for the gurus, but I need it desperately.

Problem: I have, say, a main_table with hundreds of entries.

I receive "suggestions" for corrections from the users for certain EXISTING entries in the main_table by clicking "suggest correction" link. I do not want the "suggestion" go directly into the main table. So I want to keep them in a temp_table where I can approve or discard the suggestion, and update the main_table.

1. Select the relevant entry from the main_table
X = "SELECT * FROM main_table WHERE entry = ID;

2. Pass this X to suggest.php (or function)
HOW to do?

3. Get the suggestions
Add them to temp_table

4. When required
Get the entry from temp_table and modify the corresponding entry in main_table accordingly.

I need help for the Step #2.

Thank you for all helpers, as always.

physics

12:23 am on May 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to do a bit of reading on how to program with PHP and MySQL.
Basically you just need to read the initial value into a variable, say $x, then allow the user to change that variable and submit it in a form. Input $x into the temp table. Pull the value from temp table into a variable, say $y and choose whether to input it into the main table or not. This is all done with basic database and form input/output in PHP but I don't think anyone is going to write the whole application for you here ;)

selomelo

9:12 am on May 9, 2006 (gmt 0)

10+ Year Member



Thank you Physics,

Thinking again, I should admit that I asked help too early. I should studied a bit more before posting. And although I am a nevbie both in PHP and mysql, I figured out how to code it, and managed to write a few lines of script that worked well. :-)