This topic is locked
[SOLVED]

 Update A Different Table With User Input

5/27/2013 3:12:33 PM
PHPRunner General questions
G
g_parry author

I'm trying to update one field in each row that meets specific criteria

The field holds just text.

I have created an imput form with drop down options for the user to select

After record added I have been trying the following code:

global $conn;

CustomQuery("UPDATE child SET(educational_level) ('".$values["To_Level"]."') WHERE (child.educational_level) LIKE ".$values["From_Level"]);

db_exec($strSQLInsert,$conn);


I keep getting an error - can someone help - I've been working on this most of the day and I'm going cross eyed <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=21034&image=1&table=forumtopics' class='bbc_emoticon' alt=';)' />
Thanks

C
cgphp 5/27/2013

You need only one line:



CustomQuery("UPDATE child SET educational_level = '".$values["To_Level"]."' WHERE educational_level = '".$values["From_Level"]."'");
G
g_parry author 5/27/2013



You need only one line:



CustomQuery("UPDATE child SET educational_level = '".$values["To_Level"]."' WHERE educational_level = '".$values["From_Level"]."'");



Cristian you are a super star - works perfectly - thank you