MySQL Forums
Forum List  »  Newbie

Using AI
Posted by: Raymond Jender
Date: June 01, 2024 08:53AM

AI appears to be a great learning tool! As a newbie, it helps a lot. I simply want to see if the provided "jobnumber" exists in the database. I most likely would not have used this, but is the following AI generated code secure?

$stmt = $conn->prepare("SELECT COUNT(*) FROM orderform WHERE jobnumber = ?");
$stmt->bind_param("s", $jobnumber);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();
$stmt->close();

if ($count > 0) {
echo "Job number $jobnumber exists in the database.";
} else {
echo "Job number $jobnumber does not exist in the database.";
}
Thanks.

Options: ReplyQuote


Subject
Written By
Posted
Using AI
June 01, 2024 08:53AM
June 03, 2024 05:21AM
June 03, 2024 06:30AM
June 03, 2024 07:24AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.