Hi Guys i wanna ask something
I have column in database mysql like :
199910192022032006
but when laravel datatable show that data column, its change like:
199910192022032000
why its can be happen ?
what data type are you using? integer? try to change into float or double or maybe varchar
Related
I made transformation to load data from topics to a postgres database.
Is it possible to map a field of the record in a column with different name ?
As for example : field_x > column_field_x
"fields.whitelist":"field_x"
Today this field is trying to go a column "field_x" but I would like it to go on "column_field_x"
Thanks
You can use the transformation "ReplaceField" https://docs.confluent.io/platform/current/connect/transforms/replacefield.html#replacefield
I want to show a status bar in a laravel website. Which will show the DBMS name and version number. The output I want is like
PostgreSQL 9.2.24
Or
MySQL 5.6
I can get the name of database by using env('DB_CONNECTION'). It is giving me the name(although, it is showing 'pgsql'; not 'PostgreSQL ').
However, I don't understand how can I get the version number in view. What is the way to get the version number?
You can use DB::raw() to create database raw expression.
$version = DB::select( DB::raw("select version()"));
pass the value to your view.
Im working in a project where I display different events in my view. The goal for now is to only show events that are upcoming, so it doesn't show events that are older than today.
The users of my page can create an event and set a sertain date for it.
The data is stored into my db like this:
$table->string('datum');
In the view it return it like this:
06.03.2019
My controller to return the data looks like this:
$date = date('d.m.Y');
$evententries = Event::where('datum', '>=', $date)->orderBy('datum', 'asc')->take(3)->get();
but it's somehow not working..
Anyone got any Ideas of how to fix this and what my issue is here?
btw, I'm using laravel 5.7.
Thank you :)
Hmm you are doing it on wrong way from begin...
First: why you are using string to store date value? there is much better options to store date within database...
Second: you are using date format which cannot be compared on that way (using < > =)
when you are comparing strings ie 08.03.2019 will be always smaller than 10.01.2016 because 1 > 0... so if you are comparing dates use:
db format for storing dates
for comparing use format yyyy-mm-dd because on that way even simple string comparison will give you correct result...
When i try get lat,lng from db. it is rounded but i wanna get exactly.
Value from db: float(48.835792541503906), float(2.280343294143677)
Value when get: float(48.835792541504), float(2.2803432941437)
That is also problem when save to db.
How to solve that ?
Float is not right data type for your data. Try DECIMAL.
I assume you are using MySQL but syntax is similar to other SQL databases.
I have plan to sync from my parse.com data to my postgreSql local database with JS API. To do that, i have to get all data that have null value for Column last_sync (it's mean that data did not syncing with local database).
Please help me how to get all data that last_sync is null?
You're not stating what language you're using, but this is a solution for Android:
query.whereDoesNotExist("last_sync");
This will constrain the query to only those records that don't have a value set in last_sync
For JavaScript:
query.doesNotExist("last_sync");
For Objective-C:
[query whereKeyDoesNotExist:#"last_sync"];