【发布时间】:2012-04-10 12:11:19
【问题描述】:
我在 mysql 中使用了以下查询,它可以工作
SELECT concat(userid, '-', text) FROM grades1.
当我将它嵌入到 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'];
}
?>
知道为什么会这样吗?
【问题讨论】:
-
“它不起作用”是什么意思?
标签: php mysql phpmyadmin xampp