Ich habe die folgende Abfrage in mysql und es funktioniert SELECT concat (Benutzer-ID, '-', Text) von grades1
.PHP - MYSQL Concat funktioniert nicht
Wenn ich dies in PHP einbetten, funktioniert es nicht.
<?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'];
}
?>
Eine Idee, warum das passiert?
was meinst du mit "es funktioniert nicht."? – SimonMayer