下面的查询语句从MySQL命令行执行我想要的操作,但是我也希望在网页上获得结果。这是我为此写的,但是我只得到一个错误45。
table colspan="1" align="center" VALIGN="top" border="2" cellspacing = "0" cellpadding = "5">
<td>
<?php
$query = "SELECT concat(firstname, ' ', lastname) AS 'Online Users' FROM opensim.GridUser
INNER JOIN opensim.UserAccounts ON opensim.UserAccounts.PrincipalID = opensim.GridUser.UserID WHERE opensim.GridUser.online = 'true';
";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result));
echo $result ?>
<br><br><br>
When programed this page should show
<br>Grid Users Online Names <br>
<br><br></td>
</table>
任何帮助将不胜感激。
最佳答案
删除单引号
尝试这个:
$query = "SELECT concat(firstname, ' ', lastname) AS Online_Users FROM opensim.GridUser
INNER JOIN opensim.UserAccounts ON opensim.UserAccounts.PrincipalID = opensim.GridUser.UserID WHERE opensim.GridUser.online = 'true';
";
关于php - 网页错误45,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19032503/