简体   繁体   English

显示来自 mysqli 的数据

[英]display data from mysqli

 document.write('<iframe  src=\"{<?php echo $row1['details']; ?>}\"</iframe>');

I'm trying to create an iFrame to be display using this javascript code, however when the code is executed, I can visually see the frame however, the frame is mirroring a 404 (Page Not found) error.我正在尝试使用此 javascript 代码创建要显示的 iFrame,但是当执行代码时,我可以在视觉上看到框架,但是框架反映了 404(未找到页面)错误。 Why's this?这是为什么?

https://i.stack.imgur.com/QBN9v.png https://i.stack.imgur.com/QBN9v.png

<?php echo $row1['details']; ?> <?php echo $row1['details']; ?> has got a ' while the outter function uses ' and ' to start and end its string. <?php echo $row1['details']; ?>有一个 ' 而外部函数使用 ' 和 ' 来开始和结束它的字符串。 You'd have to do such as: <?php echo $row1[\\'details\\']; ?>你必须这样做: <?php echo $row1[\\'details\\']; ?> <?php echo $row1[\\'details\\']; ?> . <?php echo $row1[\\'details\\']; ?> . Next time please provide more code and describe your issue.下次请提供更多代码并描述您的问题。

Also, you were missing a > .另外,您缺少一个>

document.write('<iframe  src=\"{<?php echo $row1[\'details\']; ?>}\"></iframe>');
<form id="process_page" name="process_page" method="post" action="cms.php">
<select name="product" id="product"  onchange=prod(this.id)>
<option value="">------</option>
<option value="A">A</option>
</select>
</form>



 <?php 
$srv_vame="localhost";
$usr_name="root";
$pswrd="";
$udb="dt";
$sql_conn=mysqli_connect($srv_vame,$usr_name,$pswrd,$udb);

$f_ssql="select * from  category";
$fsql=mysqli_query($sql_conn,$f_ssql);
$row1=mysqli_fetch_array($fsql);
?>


<script type="text/javascript">

function prod(e)
{
var e=document.getElementById(e);
var AB =e.options[e.selectedIndex].value;
if(AB == 'A')
{
document.write('<iframe  src=\"{<?php echo $row1['details']; ?>}\"></iframe>');
}

}
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM