我在mysql中使用了下面的查询,它的工作原理 SELECT concat(userid,' - ',text)FROM grades1
。PHP - MYSQL Concat不工作
当我把它嵌入到php中,它不工作。
<?php
//connect to the db
$user = 'sproc';
$pswd = 'password';
$db = 'mydb1';
$conn = mysql_connect('localhost', $user, $pswd);
mysql_select_db($db, $conn);
//run the query to search for the username and password the match
$query = "SELECT concat(userid, '-', text) FROM grades1";
$result = mysql_query($query) or die("Unable to verify user because : " . mysql_error());
//this is where the actual verification happens
while ($row = mysql_fetch_assoc($result)) {
echo $row['text'];
}
?>
任何想法为什么会发生这种情况?
你的意思是“它不起作用”。 – SimonMayer 2012-03-26 23:47:58