首页 > 解决方案 > 如何在 Sweetalert 中获取价值 Mysqli

问题描述

如何在 sweetalert 中获取价值数据库?

数据库连接


$db = new PDO("mysql:host=localhost;dbname=mydata","root","");
$stmts = $db->prepare("select * from access Where User_Id=$UserID OR File_Id =0");
    $stmts->execute();
    while($rows = $stmts->fetch()){
    $stmt = $db->prepare("select * from newfiles Where Id = ".$rows['File_Id']." OR User= $UserID ");
    $stmt->execute();}
    while($row = $stmt->fetch()){ 

和甜蜜的警报2

<script>
function Share() {
swal.fire({
title: "Who will you share?",
html: '<form name="Share" method="get" action="Share.php" enctype="multipart/form-data">'+
'<input type="text" name="username" id="username" class="form-control mb-3" style="color: #574ae2;" placeholder="Username" required>'+
'<input type="hidden" name="file" id="file" class="form-control mb-3" style="color: #574ae2;" value="<?php $row['filename'] ?>" required>'+
'<button class="btn btn-cloud btn-block my-3" type="submit" name="Submit" value="Submit" ><i class="fas fa-sign-in-alt"></i> Submit</button>'+
'</form>',
type: "info",
showCancelButton: true,
showConfirmButton: false,
confirmButtonColor: "Red",
closeOnConfirm: false,
closeOnCancel: false,
}).then((result) => {
if (result.value) {


} else {


swal.fire('Cancelled','You Cancelle', 'error');
}
});
}
</script>

我无法获得价值 $row['filename']。 我不擅长英语。我不知道什么是错误。

标签: phpmysqlisweetalert2

解决方案


推荐阅读