<div id = "newdiv">
</div>
<?php
$qry = "SELECT * from contact Where CustomerID='57'";
$result = mysql_query($qry);
while ($row = mysql_fetch_array($result)) {
?>
<script type="text/javascript" language="javascript">
function createDiv() {
$('#newdiv').append('<div id="div"'+i+'" class="ex" style="text-align: left;"><div id="div"'+i+'" class= "square"><table border="0" class = "table" ><tr><td width="51">Name:</td><td width="141"><input type="text" size="10" class = "name"></td></tr><tr><td>Title:</td><td><input type="text" size="10" class = "title"></td></tr><tr><td>Contact:</td><td><input type="text" size="10" class = "contact"></td></tr></table></div><img class="myimage" ondblclick="changeimage(this)" border="0"src="images/white_contact.png" width="60" /></div>');
$( ".ex" ).draggable({containment:'parent',cursor:'pointer',opacity:0.6});
$( ".ex" ).droppable();
}
createDiv(); // will execute when it loads this line
</script>
<?php
}
?>
我想使用 PHP 的 while 循环来检查它找到的每个联系人的 Customer 57 的联系人数量,它应该生成一个 DIV,依此类推,它们应该相互附加
我的代码只是不工作,为什么会这样?我正在使用 while 循环调用 CreateDiv() 函数