Insert a combination of strings and arrays into MYSQL












1















I have found similar questions on here, but nothing quite right for my situation. I need to make multiple entries to a database from a combination of values from a set of arrays and repeated strings. To give an example:



$sql = "INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES ('$venue', '$date', '1', '$info', '$title', '$repertoire_formatted', $time)";


$venue, $time, AND $date are arrays.
'1' should be added to EACH entry to the database without change.
$info, $title, AND $repertoire_formatted are strings that should be repeated, i.e., inserted without any variation, for each entry to the database.



So the following example shows what the contents of each variable might be:



$venue = array('venue1', 'venue7', 'venue50');
$date = array('2019-01-01', '2019-02-02', '2019-03-03');
$time = array('20:00:00', '19:00:00', '18:00:00');
$info = 'General info about this event';
$repertoire_formatted = 'Music that people will play at this event';


My SQL database is set up to take the different types of data for each input variable.



HERE is the code I have (not working):



session_start();
$_SESSION["servername"] = "localhost";
$_SESSION["username"] = "sonch_nB";
$_SESSION["password"] = 'hello';
$_SESSION["dbname"] = "sonch_MAIN";
date_default_timezone_set('Europe/Zurich');


$venue = ($_POST['venue']);
$date = ($_POST['date']);
$ensemble_id = '1'; //THIS WILL BE SET VIA LOGIN
$info = ($_POST['info']);
$title = ($_POST['title']);
//FORMAT INCOMING VARS CODE SKIPPED//

// Create connection
$conn = new mysqli($_SESSION['servername'], $_SESSION['username'], $_SESSION['password'], $_SESSION['dbname']);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

//NEED TO LOOP INPUT TO MYSQL NUMBER OF VALUES IN ARRAY
$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time) VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
$stmt->execute();
}

if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$stmt->close();









share|improve this question

























  • Do $venue and $date have the same number of elements?

    – Nick
    Nov 25 '18 at 11:54











  • Yes! They will always be identical in length....

    – Paul Clift
    Nov 25 '18 at 11:55











  • What error did you get back? You know you're executing the query twice.

    – Funk Forty Niner
    Nov 25 '18 at 14:17











  • Problem is sorted now.... the below code fixed it. It was a silly mistake on my part.

    – Paul Clift
    Nov 25 '18 at 14:19
















1















I have found similar questions on here, but nothing quite right for my situation. I need to make multiple entries to a database from a combination of values from a set of arrays and repeated strings. To give an example:



$sql = "INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES ('$venue', '$date', '1', '$info', '$title', '$repertoire_formatted', $time)";


$venue, $time, AND $date are arrays.
'1' should be added to EACH entry to the database without change.
$info, $title, AND $repertoire_formatted are strings that should be repeated, i.e., inserted without any variation, for each entry to the database.



So the following example shows what the contents of each variable might be:



$venue = array('venue1', 'venue7', 'venue50');
$date = array('2019-01-01', '2019-02-02', '2019-03-03');
$time = array('20:00:00', '19:00:00', '18:00:00');
$info = 'General info about this event';
$repertoire_formatted = 'Music that people will play at this event';


My SQL database is set up to take the different types of data for each input variable.



HERE is the code I have (not working):



session_start();
$_SESSION["servername"] = "localhost";
$_SESSION["username"] = "sonch_nB";
$_SESSION["password"] = 'hello';
$_SESSION["dbname"] = "sonch_MAIN";
date_default_timezone_set('Europe/Zurich');


$venue = ($_POST['venue']);
$date = ($_POST['date']);
$ensemble_id = '1'; //THIS WILL BE SET VIA LOGIN
$info = ($_POST['info']);
$title = ($_POST['title']);
//FORMAT INCOMING VARS CODE SKIPPED//

// Create connection
$conn = new mysqli($_SESSION['servername'], $_SESSION['username'], $_SESSION['password'], $_SESSION['dbname']);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

//NEED TO LOOP INPUT TO MYSQL NUMBER OF VALUES IN ARRAY
$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time) VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
$stmt->execute();
}

if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$stmt->close();









share|improve this question

























  • Do $venue and $date have the same number of elements?

    – Nick
    Nov 25 '18 at 11:54











  • Yes! They will always be identical in length....

    – Paul Clift
    Nov 25 '18 at 11:55











  • What error did you get back? You know you're executing the query twice.

    – Funk Forty Niner
    Nov 25 '18 at 14:17











  • Problem is sorted now.... the below code fixed it. It was a silly mistake on my part.

    – Paul Clift
    Nov 25 '18 at 14:19














1












1








1








I have found similar questions on here, but nothing quite right for my situation. I need to make multiple entries to a database from a combination of values from a set of arrays and repeated strings. To give an example:



$sql = "INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES ('$venue', '$date', '1', '$info', '$title', '$repertoire_formatted', $time)";


$venue, $time, AND $date are arrays.
'1' should be added to EACH entry to the database without change.
$info, $title, AND $repertoire_formatted are strings that should be repeated, i.e., inserted without any variation, for each entry to the database.



So the following example shows what the contents of each variable might be:



$venue = array('venue1', 'venue7', 'venue50');
$date = array('2019-01-01', '2019-02-02', '2019-03-03');
$time = array('20:00:00', '19:00:00', '18:00:00');
$info = 'General info about this event';
$repertoire_formatted = 'Music that people will play at this event';


My SQL database is set up to take the different types of data for each input variable.



HERE is the code I have (not working):



session_start();
$_SESSION["servername"] = "localhost";
$_SESSION["username"] = "sonch_nB";
$_SESSION["password"] = 'hello';
$_SESSION["dbname"] = "sonch_MAIN";
date_default_timezone_set('Europe/Zurich');


$venue = ($_POST['venue']);
$date = ($_POST['date']);
$ensemble_id = '1'; //THIS WILL BE SET VIA LOGIN
$info = ($_POST['info']);
$title = ($_POST['title']);
//FORMAT INCOMING VARS CODE SKIPPED//

// Create connection
$conn = new mysqli($_SESSION['servername'], $_SESSION['username'], $_SESSION['password'], $_SESSION['dbname']);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

//NEED TO LOOP INPUT TO MYSQL NUMBER OF VALUES IN ARRAY
$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time) VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
$stmt->execute();
}

if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$stmt->close();









share|improve this question
















I have found similar questions on here, but nothing quite right for my situation. I need to make multiple entries to a database from a combination of values from a set of arrays and repeated strings. To give an example:



$sql = "INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES ('$venue', '$date', '1', '$info', '$title', '$repertoire_formatted', $time)";


$venue, $time, AND $date are arrays.
'1' should be added to EACH entry to the database without change.
$info, $title, AND $repertoire_formatted are strings that should be repeated, i.e., inserted without any variation, for each entry to the database.



So the following example shows what the contents of each variable might be:



$venue = array('venue1', 'venue7', 'venue50');
$date = array('2019-01-01', '2019-02-02', '2019-03-03');
$time = array('20:00:00', '19:00:00', '18:00:00');
$info = 'General info about this event';
$repertoire_formatted = 'Music that people will play at this event';


My SQL database is set up to take the different types of data for each input variable.



HERE is the code I have (not working):



session_start();
$_SESSION["servername"] = "localhost";
$_SESSION["username"] = "sonch_nB";
$_SESSION["password"] = 'hello';
$_SESSION["dbname"] = "sonch_MAIN";
date_default_timezone_set('Europe/Zurich');


$venue = ($_POST['venue']);
$date = ($_POST['date']);
$ensemble_id = '1'; //THIS WILL BE SET VIA LOGIN
$info = ($_POST['info']);
$title = ($_POST['title']);
//FORMAT INCOMING VARS CODE SKIPPED//

// Create connection
$conn = new mysqli($_SESSION['servername'], $_SESSION['username'], $_SESSION['password'], $_SESSION['dbname']);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

//NEED TO LOOP INPUT TO MYSQL NUMBER OF VALUES IN ARRAY
$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time) VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
$stmt->execute();
}

if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$stmt->close();






php mysql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 12:30







Paul Clift

















asked Nov 25 '18 at 11:53









Paul CliftPaul Clift

577




577













  • Do $venue and $date have the same number of elements?

    – Nick
    Nov 25 '18 at 11:54











  • Yes! They will always be identical in length....

    – Paul Clift
    Nov 25 '18 at 11:55











  • What error did you get back? You know you're executing the query twice.

    – Funk Forty Niner
    Nov 25 '18 at 14:17











  • Problem is sorted now.... the below code fixed it. It was a silly mistake on my part.

    – Paul Clift
    Nov 25 '18 at 14:19



















  • Do $venue and $date have the same number of elements?

    – Nick
    Nov 25 '18 at 11:54











  • Yes! They will always be identical in length....

    – Paul Clift
    Nov 25 '18 at 11:55











  • What error did you get back? You know you're executing the query twice.

    – Funk Forty Niner
    Nov 25 '18 at 14:17











  • Problem is sorted now.... the below code fixed it. It was a silly mistake on my part.

    – Paul Clift
    Nov 25 '18 at 14:19

















Do $venue and $date have the same number of elements?

– Nick
Nov 25 '18 at 11:54





Do $venue and $date have the same number of elements?

– Nick
Nov 25 '18 at 11:54













Yes! They will always be identical in length....

– Paul Clift
Nov 25 '18 at 11:55





Yes! They will always be identical in length....

– Paul Clift
Nov 25 '18 at 11:55













What error did you get back? You know you're executing the query twice.

– Funk Forty Niner
Nov 25 '18 at 14:17





What error did you get back? You know you're executing the query twice.

– Funk Forty Niner
Nov 25 '18 at 14:17













Problem is sorted now.... the below code fixed it. It was a silly mistake on my part.

– Paul Clift
Nov 25 '18 at 14:19





Problem is sorted now.... the below code fixed it. It was a silly mistake on my part.

– Paul Clift
Nov 25 '18 at 14:19












1 Answer
1






active

oldest

votes


















1














You should use a prepared statement. In MySQLi (assuming your connection is $conn):



$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
if ($stmt->execute() === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $conn->error;
}
}
$stmt->close();





share|improve this answer


























  • Sorry, I left those vars out in my original post; have corrected it now...

    – Paul Clift
    Nov 25 '18 at 12:09











  • Ok, I've edited the code to allow $time to be an array as well.

    – Nick
    Nov 25 '18 at 12:12











  • Hmm, this is coming up with an error, but no other info is given from my echo "Error: " . $sql . "<br>" . $conn->error;

    – Paul Clift
    Nov 25 '18 at 12:17











  • @PaulClift where are you doing the echo? if it is after $stmt->close() it will be empty

    – Nick
    Nov 25 '18 at 12:19











  • No, I added the following before $stmt->close() -- if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; }

    – Paul Clift
    Nov 25 '18 at 12:23











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53467152%2finsert-a-combination-of-strings-and-arrays-into-mysql%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You should use a prepared statement. In MySQLi (assuming your connection is $conn):



$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
if ($stmt->execute() === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $conn->error;
}
}
$stmt->close();





share|improve this answer


























  • Sorry, I left those vars out in my original post; have corrected it now...

    – Paul Clift
    Nov 25 '18 at 12:09











  • Ok, I've edited the code to allow $time to be an array as well.

    – Nick
    Nov 25 '18 at 12:12











  • Hmm, this is coming up with an error, but no other info is given from my echo "Error: " . $sql . "<br>" . $conn->error;

    – Paul Clift
    Nov 25 '18 at 12:17











  • @PaulClift where are you doing the echo? if it is after $stmt->close() it will be empty

    – Nick
    Nov 25 '18 at 12:19











  • No, I added the following before $stmt->close() -- if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; }

    – Paul Clift
    Nov 25 '18 at 12:23
















1














You should use a prepared statement. In MySQLi (assuming your connection is $conn):



$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
if ($stmt->execute() === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $conn->error;
}
}
$stmt->close();





share|improve this answer


























  • Sorry, I left those vars out in my original post; have corrected it now...

    – Paul Clift
    Nov 25 '18 at 12:09











  • Ok, I've edited the code to allow $time to be an array as well.

    – Nick
    Nov 25 '18 at 12:12











  • Hmm, this is coming up with an error, but no other info is given from my echo "Error: " . $sql . "<br>" . $conn->error;

    – Paul Clift
    Nov 25 '18 at 12:17











  • @PaulClift where are you doing the echo? if it is after $stmt->close() it will be empty

    – Nick
    Nov 25 '18 at 12:19











  • No, I added the following before $stmt->close() -- if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; }

    – Paul Clift
    Nov 25 '18 at 12:23














1












1








1







You should use a prepared statement. In MySQLi (assuming your connection is $conn):



$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
if ($stmt->execute() === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $conn->error;
}
}
$stmt->close();





share|improve this answer















You should use a prepared statement. In MySQLi (assuming your connection is $conn):



$stmt = $conn->prepare("INSERT INTO sonch_MAIN.Concert (venue_id, date, ensemble_id, info, title, repertoire, time)
VALUES (?, ?, '1', ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $v, $d, $info, $title, $repertoire_formatted, $t);
for ($i = 0; $i < count($venue); $i++) {
$v = $venue[$i];
$d = $date[$i];
$t = $time[$i];
if ($stmt->execute() === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $conn->error;
}
}
$stmt->close();






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 25 '18 at 12:38

























answered Nov 25 '18 at 12:02









NickNick

33.2k132042




33.2k132042













  • Sorry, I left those vars out in my original post; have corrected it now...

    – Paul Clift
    Nov 25 '18 at 12:09











  • Ok, I've edited the code to allow $time to be an array as well.

    – Nick
    Nov 25 '18 at 12:12











  • Hmm, this is coming up with an error, but no other info is given from my echo "Error: " . $sql . "<br>" . $conn->error;

    – Paul Clift
    Nov 25 '18 at 12:17











  • @PaulClift where are you doing the echo? if it is after $stmt->close() it will be empty

    – Nick
    Nov 25 '18 at 12:19











  • No, I added the following before $stmt->close() -- if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; }

    – Paul Clift
    Nov 25 '18 at 12:23



















  • Sorry, I left those vars out in my original post; have corrected it now...

    – Paul Clift
    Nov 25 '18 at 12:09











  • Ok, I've edited the code to allow $time to be an array as well.

    – Nick
    Nov 25 '18 at 12:12











  • Hmm, this is coming up with an error, but no other info is given from my echo "Error: " . $sql . "<br>" . $conn->error;

    – Paul Clift
    Nov 25 '18 at 12:17











  • @PaulClift where are you doing the echo? if it is after $stmt->close() it will be empty

    – Nick
    Nov 25 '18 at 12:19











  • No, I added the following before $stmt->close() -- if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; }

    – Paul Clift
    Nov 25 '18 at 12:23

















Sorry, I left those vars out in my original post; have corrected it now...

– Paul Clift
Nov 25 '18 at 12:09





Sorry, I left those vars out in my original post; have corrected it now...

– Paul Clift
Nov 25 '18 at 12:09













Ok, I've edited the code to allow $time to be an array as well.

– Nick
Nov 25 '18 at 12:12





Ok, I've edited the code to allow $time to be an array as well.

– Nick
Nov 25 '18 at 12:12













Hmm, this is coming up with an error, but no other info is given from my echo "Error: " . $sql . "<br>" . $conn->error;

– Paul Clift
Nov 25 '18 at 12:17





Hmm, this is coming up with an error, but no other info is given from my echo "Error: " . $sql . "<br>" . $conn->error;

– Paul Clift
Nov 25 '18 at 12:17













@PaulClift where are you doing the echo? if it is after $stmt->close() it will be empty

– Nick
Nov 25 '18 at 12:19





@PaulClift where are you doing the echo? if it is after $stmt->close() it will be empty

– Nick
Nov 25 '18 at 12:19













No, I added the following before $stmt->close() -- if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; }

– Paul Clift
Nov 25 '18 at 12:23





No, I added the following before $stmt->close() -- if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; }

– Paul Clift
Nov 25 '18 at 12:23




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53467152%2finsert-a-combination-of-strings-and-arrays-into-mysql%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python