exists not to add it?
I currently have it like this
function addPremiumUser($userID){
global $conn;
if(!$userData){
$addtodb = mysqli_query($conn,"SELECT userid FROM premium WHERE userid=$userID;");
logsummary("<b>❌ [LOG] New User Error - existing $userID</b>");
return True;
} else {
$addtodb = mysqli_query($conn,"INSERT INTO premium (userid, username) VALUES ('$userID', '$username')");
logsummary("<b>✅ [LOG] New User - $userID</b>");
returnFalse;
}
}
But although the data does not exist, I get that it already exists
U need to set the condition after first query
There it is but it only enters the first condition and there it stays
https://t.me/BotTalk/637967
In this way, u are running two queries U can use one query for insert if not exist https://stackoverflow.com/questions/1361340/how-can-i-do-insert-if-not-exists-in-mysql
Обсуждают сегодня