Hi
Mir ist heute aufgefallen das wenn ich eine SQL Abfrage in PHP mache, sind manche Resultate teilweise falsch bei der Gross –Kleinschreibung.
Bsp. Resultate:
phpadmin Abfrage AbCd, Auto
PHP Abfrage: Abcd, auto
Weiss jemand wieso?
Hier mein Code:
Mir ist heute aufgefallen das wenn ich eine SQL Abfrage in PHP mache, sind manche Resultate teilweise falsch bei der Gross –Kleinschreibung.
Bsp. Resultate:
phpadmin Abfrage AbCd, Auto
PHP Abfrage: Abcd, auto
Weiss jemand wieso?
Hier mein Code:
PHP-Code:
<?php
try
{
$pdo = new PDO('mysql:host='.HOST.';dbname='.DATABASE. ';charset=utf8', USER, PASSWORD);
}
catch (PDOException $e)
{
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
PHP-Code:
<?php
require_once("../../config.php");
require_once("../../db_connect.php");
$sql = "SELECT
tbl_daily.*,
tbl_notes.idDaily AS idDailyN,
tbl_notes.notes AS NoteText,
tbl_notes.createdDate AS NoteTime,
tbl_notes.userName AS NoteUser
FROM
tbl_daily
LEFT JOIN
tbl_notes ON tbl_daily.idDaily = tbl_notes.idDaily
WHERE
tbl_daily.status != 'todo'
ORDER BY
`tbl_daily`.`idDaily` ASC";
$result = $pdo->prepare($sql) or die("MySQL-Error: " . mysql_error());
$result->execute();
while ($row = $result->fetch()) {
echo $row['userName']."<br>";
}
Kommentar