这可能很容易解决,但这段代码有什么问题?所有div的回声都没有到达终点,因此只有一部分被引用,从开头开始到结束但我不知道这有什么不对。
</header>
<?php $db_name = 'submissions';
$db_user = 'root';
$db_pass = '';
$db_host = 'localhost';
$link = mysql_connect("localhost", $db_user, $db_pass) or die(mysql_error());
mysql_select_db("submissions",$link) or die(mysql_error());
$query1 = mysql_query("SELECT actual_quote,poster,formtype FROM data WHERE formtype = 'Inspirational'",$link);
$postid = 1;
$data = mysql_fetch_object(mysql_query("SELECT `like`, `unlike` FROM data WHERE id='".$postid."'"));
while($info = mysql_fetch_array($query1)){
echo '
<div class="wrapper">
<div class="submissions">
<div class="logo-logo"><h2>Questions.</h2>
<div class="checkboxes">'.$info['formtype'].'
</div>
</div>
<div class="top-submit">
“'. $info["actual_quote"] . '”
</div>
<div class="poster">- '. $info["poster"].'
<div class = "like">
<a href = "javascript:;" onclick = "doAction('<?php echo $postid; ?>', 'like');">Like (<span id =' <?php echo $postid; ?>_likes'><?php echo $data->like;?></span>)</a>
</div>
<div class = "dislike">
<a href = "javascript:;" class = "btn btn-large" style = "float:right; color:red;" onclick = "doAction('<?php echo $postid;?>', 'unlike');">Dislike (<span id ='echo $postid;_unlikes'><?php echo $data->unlike;?></span>)</a>
</div>
</div>
<!-- use select to get the items to stay on the page-->
</div>
</div>
</div>
';
}
?>
答案 0 :(得分:1)
你有嵌入其他php代码的php代码。
这不起作用:
<?php
<?php
echo 'hello';
?>
?>