Posted: 06.02.2004 23:30 Post subject: mySQL - date
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??
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:
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 :)
*/
_________________ 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
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?
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.
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.
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";
Joined: 13 Nov 2003 Posts: 1397 Location: Karlovac
Posted: 08.02.2004 19:59 Post subject:
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
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.
_________________ 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
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