Php 如何选择除一列以外的所有列?
如何选择数据库中除用户所在列以外的所有列 我希望所有数据都发布在我的xml页面中,而不是显示当前用户信息的行Php 如何选择除一列以外的所有列?,php,xml,database,Php,Xml,Database,如何选择数据库中除用户所在列以外的所有列 我希望所有数据都发布在我的xml页面中,而不是显示当前用户信息的行 <?php include_once 'test-dbconnect.php'; function parseToXML($htmlStr) { $xmlStr=str_replace('<','<',$htmlStr); $xmlStr=str_replace('>','>',$xmlStr);
<?php
include_once 'test-dbconnect.php';
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
$sql = "select * from tbl_users WHERE username != '".$row['username']."'";
$result = mysqli_query($DBcon, $sql) or die("Error in Selecting " . mysqli_error($DBcon));
//create an array
$user_data = array();
while($row =mysqli_fetch_assoc($result))
{
$user_data[] = $row;
echo '<marker ';
echo 'name="' . parseToXML($row['username']) . '" ';
echo 'address="' . parseToXML($row['address']) . '" ';
echo 'latitude="' . $row['latitude'] . '" ';
echo 'longitude="' . $row['longitude'] . '" ';
echo '/>';
}
//close the db connection
mysqli_close($DBcon);
// End XML file
echo '</markers>';
?>
要排除列还是行?您写道您想排除行,但您的代码显示的是相反的。@ElChupacabra我想排除一列,更具体地说,我想排除包含当前用户数据的列。关于我的代码,您是什么意思