duangan6797 2019-03-22 04:05
浏览 16

如何在sweetalert中获得价值Mysqli

How to get value Database in sweetalert ?

DataBase connect


$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()){ 

And Sweet Alert2

<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>

I can't get value $row['filename']. I am not good at English. I don't know what is error.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用
    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教