Hello,
$sql = "INSERT INTO msg SET to_id = SELECT id FROM users WHERE username = 'test'";
msg
to_id
id
users
username
I want to make something like that, but i don't know the right syntax.
Please help.
$sql = "INSERT INTO msg SET to_id = (SELECT id FROM users WHERE username = 'test')";
note: you must have mySQL 4.1 or higher to use subqueries