<?PHP
$query = "SELECT * FROM `projects` ";
$query .= "WHERE `v_active` = '1' ";
$query .= "ORDER BY `title` ASC ";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
// GET DATA
echo $row["title"]." "."<br />";
echo ($row["v_address"])? " ".$row["v_address"] : "";
echo ($row["v_email"])? "<a href='mailto:".$row["v_email"]."'>".$row["v_email"]."</a> <br />" : " ";
echo ($row["v_website"])? "<a href='".$row["v_website"]."'>".$row["v_website"]."</a> <br />" : " ";
echo ($row["v_comment"])? " ".$row["v_comment"] : "";
?>
嗨!抱歉这个愚蠢的问题,但我想在v_address字段之后添加另一个换行符(就像其他行一样),但似乎我无法绕过引号或其他东西,因为每当我尝试添加一个我得到一个T_CONSTANT_ENCAPSED_STRING错误。帮助一个新手?谢谢!
答案 0 :(得分:2)
应该就是这个 -
echo ($row["v_address"])? " ".$row["v_address"] . "<br />" : "";
答案 1 :(得分:0)
不确定你是怎么做的,但这应该有效
<?php
$query = "SELECT * FROM `projects` ";
$query .= "WHERE `v_active` = '1' ";
$query .= "ORDER BY `title` ASC ";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
// GET DATA
echo $row["title"]." "."<br />";
echo ($row["v_address"])? " ".$row["v_address"] . "<br/>" : "";
echo ($row["v_email"])? "<a href='mailto:".$row["v_email"]."'>".$row["v_email"]."</a> <br />" : " ";
echo ($row["v_website"])? "<a href='".$row["v_website"]."'>".$row["v_website"]."</a> <br />" : " ";
echo ($row["v_comment"])? " ".$row["v_comment"] : "";
?>