First set of code, on separate page than second
<?php
include 'HytecFunctions.php';
if((isset($_POST["name"])) ) {
$name = $_POST["name"];
addName($name);
}
Second and Separate Page code
function updateScore() {
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$conn = connectDB();
// Score Update
$name = "Test1";
// $name = getName();
$sql = $conn->prepare("SELECT Score FROM Names WHERE Name=?");
$sql->bind_param('s',$name);
$sql->execute();
$sql->bind_result($score);
$sql->fetch();
$sql->close();
The user enters a name and it is entered into a database as seen in the first code snippet. Then I need to use that $name in a separate code file so that it looks more like this, and stays dynamic with the user's name.
function updateScore() {
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$conn = connectDB();
$sql = $conn->prepare("SELECT Score FROM Names WHERE Name=?");
$sql->bind_param('s',$name);
I need the name to be entered and then used here to bind the user's name to the prepare statement.
$sql->execute();
$sql->bind_result($score);
$sql->fetch();
$sql->close();
Any ideas or help would be greatly appreciated!!
Aucun commentaire:
Enregistrer un commentaire