if (isset($_POST['field1'])) {
$id = mysql_real_escape_string($_POST['thisID']);
$field1 = mysql_real_escape_string($_POST['one']);
$field2 = mysql_real_escape_string($_POST['two']);
$field3 = mysql_real_escape_string($_POST['three']);
$field4 = mysql_real_escape_string($_POST['four']);
$newvariable = mysql_query("SELECT id from table2 WHERE columb2 = '" . $field1 . "'");
$sql = mysql_query("UPDATE table1 SET column1='$field2', column2='$field3', column3='$field4', column4='$field1', column5='$newvariable' WHERE id='$id'");
Now there is my php code everything works apart from it $newvariable line cannot find the id from table 2 and the mysql update query just places a "0" into my database i have tried many different solutions to this but none have worked. i have tried just putting the variable name within single quotes... '$field1' i have tryed double quotes i have tried putting the mysql escape function within the $newvariable function. nothing has worked hopefully someone can suggest some new solutions that will or may work. ps i have tried running the similar mysql statement direct from phpmyadmin and it works it finds the values needed. i have tryed just putting a number into the $sql statement on the last line of the php code there instead of $newvariable i just places a number there to test and it worked fine. it just doesnt seem to be able to compare the columb2 with the $field1 variable in the where clause :/.