Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
mySQL - date

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
bforsek



Joined: 14 Oct 2003
Posts: 60

PostPosted: 06.02.2004 22:30    Post subject: mySQL - date Add user to your forum ignore list Reply with quote

pokusavam nekako postaviti type da bude "date" ali nikako nece...

no imam i drugo pitanje... u kakve se svrhe sve moze koristiti PHP? ja sam mislio da je to jezik koji se bavi sa bazama podataka, no isao sam gledat za besplane hostove, i puno ih podrzava PHP ali ne i mysql.. tako da mene zanima sta se moze radit sa php-om bez baza??
Back to top
View user's profile Send private message
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 06.02.2004 23:00    Post subject: Add user to your forum ignore list Reply with quote

s php-om bez baze mozes isto sto i sa bazom, sam kaj ces imat frke - naime, mozes kreirati algoritam za upisivanje i citanje u .txt file, te onda upotrebljavati taj sistem zapisa sadrzaja, ali kao sto vec naslucujes - to je dost tesko (dosadno u pm) za izvesti.

inace, prilikom odredjivanja datuma - ja stavljam obicno da mi type bude int(11) pa u to polje stavim time() (broj sekundi od 1970 blah blah znas i sam) te sa date funkcijom cupam datum. npr:

Code:

// $time je recimo neko vrijeme pohranjeno u bazi

echo date("m:d:y @ G:i", $time);

/* sto ce proizvest:
6.2.2004 @ 23:00
*/
Back to top
View user's profile Send private message
_butch



Joined: 10 Sep 2003
Posts: 870
Location: Maichno, Krlovc

PostPosted: 06.02.2004 23:04    Post subject: Add user to your forum ignore list Reply with quote

probaj staviti timestamp(14);
i kada ubacujes za vrijeme ->
insert into vrijeme (id, vrijeme) values ('', 'NOW()');

onda dobijes nesto vako -> 20040206225537
2004 02 06 22 : 55 : 37 -> godina, mjesec, dan sat, min, sec

izvadis si vrijeme iz tablice, i stavis array iz tablice recimo u varijablu $vrijeme i izvuces si varijednosti za godinu, mjesec, dan, sat... u par varijabli

Code:

<?php
/*
vec smo izvadili podatke izbaze i stavili ih u varijablu vrijeme
i krecemo :)
*/

      $godina = substr($vrijeme, 2, 2);
      $mjesec = substr($vrijeme, 4, 2);
      $dan = substr($vrijeme, 6, 2);
      $sati = substr($vrijeme, 8, 2);
      $minuta = substr($vrijeme, 10, 2);
      
?>

_________________
FRENCH GUARD: No chance, English bed-wetting types.
I burst my pimples at you and call your door-opening request a silly thing, you tiny-brained wipers of other people's bottoms!
Flikrac
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bforsek



Joined: 14 Oct 2003
Posts: 60

PostPosted: 07.02.2004 21:43    Post subject: Add user to your forum ignore list Reply with quote

thanx... sredio sam to sa datumom

no treba mi jos informacija o PHP-u bez baza.. trazio sam na netu tutoriale al nikak da nadjem to sa .TXT fajlovima... i dali mogu koristiti MSAccess baze sa php-om?
Back to top
View user's profile Send private message
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 08.02.2004 11:09    Post subject: Add user to your forum ignore list Reply with quote

ovo sa .txt datotekama je uzasno naporno za napravit i savjetujem da ne ides tako daleko da ces slagat add/edit/delete sistem preko fajlova..
prouci u php-ovoj dokumentaciji funkciju fopen i ostale file funkcije.

---------------------------------------------------

copy paste iz manuala (www.php.net):

---------------------------------------------------

Can I access Microsoft Access databases?

Yes. You already have all the tools you need if you are running entirely under Windows 9x/Me, or NT/2000, where you can use ODBC and Microsoft's ODBC drivers for Microsoft Access databases.

If you are running PHP on a Unix box and want to talk to MS Access on a Windows box you will need Unix ODBC drivers. OpenLink Software has Unix-based ODBC drivers that can do this. There is a free pilot program where you can download an evaluation copy that doesn't expire and prices start at $675 for the commercial supported version.

Another alternative is to use an SQL server that has Windows ODBC drivers and use that to store the data, which you can then access from Microsoft Access (using ODBC) and PHP (using the built in drivers), or to use an intermediary file format that Access and PHP both understand, such as flat files or dBase databases. On this point Tim Hayes from OpenLink software writes: Using another database as an intermediary is not a good idea, when you can
use ODBC from PHP straight to your database - i.e. with OpenLink's drivers. If
you do need to use an intermediary file format, OpenLink have now released
Virtuoso (a virtual database engine) for NT, Linux and other unix platforms.
Please visit our website for a free download.



One option that has proven successful is to use MySQL and its MyODBC drivers on Windows and synchronizing the databases. Steve Lawrence writes:



Install MySQL on your platform according to instructions with MySQL. Latest available from www.mysql.com (get it from your mirror!). No special configuration required except when you set up a database, and configure the user account, you should put % in the host field, or the host name of the Windows computer you wish to access MySQL with. Make a note of your server name, username, and password.

Download the MyODBC for Windows driver from the MySQL site. Latest release is myodbc-2_50_19-win95.zip (NT available too, as well as source code). Install it on your Windows machine. You can test the operation with the utilities included with this program.

Create a user or system dsn in your ODBC administrator, located in the control panel. Make up a dsn name, enter your hostname, user name, password, port, etc for you MySQL database configured in step 1.

Install Access with a full install, this makes sure you get the proper add-ins.. at the least you will need ODBC support and the linked table manager.

Now the fun part! Create a new access database. In the table window right click and select Link Tables, or under the file menu option, select Get External Data and then Link Tables. When the file browser box comes up, select files of type: ODBC. Select System dsn and the name of your dsn created in step 3. Select the table to link, press OK, and presto! You can now open the table and add/delete/edit data on your MySQL server! You can also build queries, import/export tables to MySQL, build forms and reports, etc.
Back to top
View user's profile Send private message
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 08.02.2004 12:26    Post subject: Add user to your forum ignore list Reply with quote

zanima me, jel u php-u obavezno deklarirati sve varijable kao u c-u?
(u asp-u nije, pa pitam)

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
edgar



Joined: 28 Dec 2003
Posts: 916
Location: Pred monitorom

PostPosted: 08.02.2004 12:56    Post subject: Add user to your forum ignore list Reply with quote

carr wrote:
zanima me, jel u php-u obavezno deklarirati sve varijable kao u c-u?
(u asp-u nije, pa pitam)


to sam i ja mislio:)=

nije:)

_________________
Digital Genetics | Koote | Nuspojava
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 08.02.2004 12:57    Post subject: Add user to your forum ignore list Reply with quote

carr wrote:
zanima me, jel u php-u obavezno deklarirati sve varijable kao u c-u?
(u asp-u nije, pa pitam)

tip varijable nije potrebno deklarirati. deklaracija varijable je potrebna ako upotrebljavas klase (objektno orijentirani php) pa moras navesti sa var $varijabla; unutar klase kako bi pridruzio varijablu klasi te ako zelis ucinit varijablu dostupnu svim funkcijama - onda je deklariras sa global $var = "nesto";

to je to Smile
Back to top
View user's profile Send private message
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 08.02.2004 18:59    Post subject: Add user to your forum ignore list Reply with quote

maxy wrote:

tip varijable nije potrebno deklarirati. deklaracija varijable je potrebna ako upotrebljavas klase (objektno orijentirani php) pa moras navesti sa var $varijabla; unutar klase kako bi pridruzio varijablu klasi te ako zelis ucinit varijablu dostupnu svim funkcijama - onda je deklariras sa global $var = "nesto";

to je to Smile


mraq. znaci konverzije recimo string u int, int u string, sve automacki jel?

a sta si ti ovdje radio?
"int(11)"

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
_butch



Joined: 10 Sep 2003
Posts: 870
Location: Maichno, Krlovc

PostPosted: 08.02.2004 19:10    Post subject: Add user to your forum ignore list Reply with quote

all about colums and int sh*it in mysql database

_________________
FRENCH GUARD: No chance, English bed-wetting types.
I burst my pimples at you and call your door-opening request a silly thing, you tiny-brained wipers of other people's bottoms!
Flikrac
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 08.02.2004 20:56    Post subject: Add user to your forum ignore list Reply with quote

carr wrote:

mraq. znaci konverzije recimo string u int, int u string, sve automacki jel?

a sta si ti ovdje radio?
"int(11)"


konverzija string-int-float ide automatski kak si reko. dodatno, ako dojde do int overflowa, onda se automatski casta u float.

int(11) znaci da je polje tipa integer (u mysqlu) i da treba sacuvati 11 mjesta za zapis znamenaka tak da se potrpa potreban broj sekundi od 1.1.1970.
Back to top
View user's profile Send private message
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 08.02.2004 22:20    Post subject: Add user to your forum ignore list Reply with quote

maxy wrote:

konverzija string-int-float ide automatski kak si reko. dodatno, ako dojde do int overflowa, onda se automatski casta u float.

int(11) znaci da je polje tipa integer (u mysqlu) i da treba sacuvati 11 mjesta za zapis znamenaka tak da se potrpa potreban broj sekundi od 1.1.1970.


svidja mi se.
el tako mi3 ima rjeseno ono "zadnji post prije 1h 20min.." i to?

zapravo mi se jako svidja,onda i sortiranje radi ko beba i sve...super ideja..

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 09.02.2004 11:10    Post subject: Add user to your forum ignore list Reply with quote

najvjerojatnije imaju taj sistem. imho pohranjivanje time()-a je najbolje za pracenje necega posto mozes u sekundu izracunat kad, tko, sto i gdje.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group