Hello all wondering if anyone could help. Client requests me to create a database that has a table for each user that signs up. The user gets to specify the table name. I know terrible idea but they refuse to consider other options and well I'm getting paid so ill do as they wish.
Right creating the table with the table name dynamically was easy. The difficult part is creating the trigger with dynamic table name.
So far I have;
Where $ID is the same variable used to create the table in the first query.
Obviously being followed by an if/else to show result and to continue with the next set of instructions. However its failing
Right creating the table with the table name dynamically was easy. The difficult part is creating the trigger with dynamic table name.
So far I have;
$sql = mysql_query("CREATE TRIGGER 'triggername' AFTER INSERT ON '{$ID}' FOR EACH ROW UPDATE localhost@table SET Variable1 = Variable1+1 WHERE Variable2 = Variable2");
Where $ID is the same variable used to create the table in the first query.
Obviously being followed by an if/else to show result and to continue with the next set of instructions. However its failing

Last edited: