I have been working on this problem for months now and I just can't get it to work properly.
let me explain.
I want to move the last record only from a table called users into a new table called members. The new table called members has two additional fields called parent_id and child_count. child_count is incremented by 1 until it reaches 8. When child_count = 8 the parent_id is incremented by 1.
I like to usually work out my own problems. But I have to finally admit now that I am well and truly stuck.
I have tried all kinds of combination's. I need someone to put me out of my misery.
The code is:
Code: Select all
$q = "INSERT INTO ".USERS."
VALUES ('$username', '$password', '0', $ulevel, '$email', $time)";
return mysql_query($q, $this->connection);
$sql = "SELECT username,child_count FROM" .members.
$sql = "INSERT INTO".matrix_members. "VALUES (‘‘, username, email) SELECT username, email
FROM" .TBL_USERS. "ORDER BY timestamp DESC LIMIT 1";
child_count = child_count + 1
return mysql_query($sql, $this->connection);
$sql = "UPDATE " .MEMBERS. "SET child_count 0, parent_id = parent_id + 1
WHERE SELECT username,child_count FROM" .members.
"ORDER BY timestamp DESC LIMIT 1"