-3

Hi anyone know how to get the TID. I only need the TID and set it to variable $TID

$sql = 'SELECT TID FROM  walkin ORDER BY TID DESC LIMIT 1';

$result = mysqli_query($conn, $sql);

if ($conn->error) {
    die("Query failed: " . $conn->error);
}
$TID = /answer here/
3

1 Answer 1

0

How about a prepared statement with a bind_result and fetch call?

if($stmt=$conn->prepare("SELECT TID FROM walkin ORDER BY TID DESC LIMIT 1")){
    if($stmt->execute() && $stmt->bind_result($TID) && $stmt->fetch()){
        echo $TID;
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

@Isaiah Did my answer solve your problem? If so, please award the green tick to my answer. If not, please leave me a comment describing what has gone wrong for you while implementing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.