Reputation: 13
I need to show Data from today from a certain column. Can anyone help? Nothing appears. Thanks! Connection seems to work.
<?php
$db = mysqli_connect("server", "username", "pw", "database");
if(!$db)
{
exit("Verbindungsfehler: ".mysqli_connect_error());
}
?>
<?php
$abfrage = "SELECT type FROM customers WHERE DATE(time) = CURDATE()";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
echo "$row->Spaltenname";
}
?>
Upvotes: 0
Views: 343
Reputation: 36
In addition to the query problem, you have another problem with your code, you used mysqli_connect, then you started to use the old deprecated mysql_* methods.
ini_set('display_errors', '1');
error_reporting (-1);
$abfrage = "SELECT * FROM `customers` WHERE DATE(`time`) = CURDATE()";
$ergebnis = mysqli_query($db, $abfrage);
echo mysqli_error($db);
while($row = mysqli_fetch_object($ergebnis))
{
echo $row->Spaltenname;
}
Upvotes: 1
Reputation: 1217
Your query is only retrieving the "type" column.
$abfrage = "SELECT * FROM customers WHERE DATE(time) = CURDATE()";
Potentially expanding the columns in your SELECT may fix this?
Goodluck.
Upvotes: 0