hi i'm having difficulty trying to insert multiple row of data where userid = deviceid (Which will be taken from the .php URL)
e.g. url.com/test/this.php?deviceid=abc
This are my code:
$sql = "INSERT INTO notif (message,userid) VALUES ('hi', (select userid from devices where deviceid = '" . $deviceid . "'))";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
The main goal is that i want the database to insert the amount of users with the message of 'hi' as well
Here's an example
Message | userid
hi | john
hi | mary
hi | Jake
etc..
please help me.. i'll do my best to reply
thanks