tags:

views:

28

answers:

2
$produpd = "UPDATE tblnavpc SET tblnavpc.ChildName = tblnav.NavName " .
    "FROM tblnav WHERE tblnavpc.CID = tblnav.NavID";

This is the error I get"

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM tblnav WHERE tblnavpc.CID = tblnav.NavID' at line 1

I know keys aren't named greatly but I just trying to fix this one problem, I didn't name the tables.

A: 

"From" cannot be used with update statements. Should be

$produpd = "UPDATE tblnavpc SET tblnavpc.ChildName = tblnav.NavName " .
    "WHERE tblnavpc.CID = tblnav.NavID";
Ilya Biryukov
Where does this select the table tblnav ?
Andomar
+3  A: 

You don't have a FROM clause in an update:

UPDATE tblnavpc
INNER JOIN tblnav ON tblnavpc.CID = tblnav.NavID
SET tblnavpc.ChildName = tblnav.NavName
Greg
Thanks. I gave you credit cuz I tried yours solution first. I didn't think i could use a FROM clause either but I started trying anything I could think of besides INNER JOIN.
Kauthon