Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Tech > [Forum PHP] ...thread e post...
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Hamelin
.pifferaio.magico.

User info:
Registered: Feb 2003
Posts: 662 (0.08 al dì)
Location: ..tra i monti intorno ad Hamelin..
Corso: Ingegneria Informatica
Anno:
Time Online: 7 Days, 7:19:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Question [Forum PHP] ...thread e post...

Sto provando a costruire un forummino semplice semplice per studio sul mio pc... Apache/PHP/MySQL, ovviamente...
L'idea sarebbe un forum unico, non diviso per argomenti. Il problema è questo: ho bisogno (vero?) di avere un numero di identificazione per ogni post, ma anche un ID per sapere a quale thread il dato post appartiene... ora, se per l'ID del post basta che nella tabella inserisca un campo tipo:

INT (4) UNSIGNED auto_increment not null

(ma il not null mi serve in questo caso?), per l'ID del thread (chiamiamolo così) come faccio?: faccio una seconda tabella? Con che campi? Come la concilio con la prima? HELP!!!

__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."

24-03-2004 13:26
Click Here to See the Profile for Hamelin Click here to Send Hamelin a Private Message Visit Hamelin's homepage! Find more posts by Hamelin Add Hamelin to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
korn
SET FIRE!

User info:
Registered: Jun 2002
Posts: 5793 (0.69 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

E' molto più semplice di quel che pensi :)

Io farei così:

Crea un campo ID_THREAD di tipo INT in cui:

- se il valore è 0 significa che quel post è l'inizio di un thread

- se il valore non è 0 significa che quel post è una risposta ad un thread il cui ID è il valore stesso

Per ordinare correttamente la sequenza dei thread e dei post ti consiglieri di utilizzare un campo contenente un timestamp unix, ma con l'ID auto_increment in teoria basterebbe ordinarli per ID per avere la sequenza corretta (teoricamente non dovrebbe riutilizzare come ID eventuali valori di post cancellati, cosa che invece creerebbe dei problemi di ordinamento).

__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.

24-03-2004 20:55
Click Here to See the Profile for korn Click Here to See the Blog of korn Click here to Send korn a Private Message Visit korn's homepage! Find more posts by korn Add korn to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Napolux
-29 Kg da Settembre 2005

User info:
Registered: Jun 2002
Posts: 3666 (0.44 al dì)
Location: Giussano (MI)
Corso: F28
Anno: ???
Time Online: 21 Days, 19:29:36 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by korn
E' molto più semplice di quel che pensi :)

Io farei così:

Crea un campo ID_THREAD di tipo INT in cui:

- se il valore è 0 significa che quel post è l'inizio di un thread

- se il valore non è 0 significa che quel post è una risposta ad un thread il cui ID è il valore stesso

Per ordinare correttamente la sequenza dei thread e dei post ti consiglieri di utilizzare un campo contenente un timestamp unix, ma con l'ID auto_increment in teoria basterebbe ordinarli per ID per avere la sequenza corretta (teoricamente non dovrebbe riutilizzare come ID eventuali valori di post cancellati, cosa che invece creerebbe dei problemi di ordinamento).


:sbav:

Questa idea non mi sarebbe mai venuta in 5000 anni... :D

Korn, ti devo frequentare piu' spesso :asd:

__________________
Napolux.com

25-03-2004 12:57
Click Here to See the Profile for Napolux Click Here to See the Blog of Napolux Click here to Send Napolux a Private Message Visit Napolux's homepage! Find more posts by Napolux Add Napolux to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Mino
In pensione :)

User info:
Registered: Mar 2002
Posts: 2997 (0.36 al dì)
Location: Dublin!
Corso: Informatica 3ennale
Anno: Laureato :)
Time Online: 12 Days, 2:11:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

giusto per curiosita': il vbulletin (questo forum) e il phpbb utilizzano due tabelle, una per i thread e una per i post.

Quella dei thread include principalmente:
- id del thread "autoincrementativo"
- topic
- id dell'autore
- timestamp, ecc ecc

Quella dei post:
- id del post "autoincrementativo"
- id del thread a cui il post appartiene
- titolo e testo del post
- id dell'autore
- timestamp, ecc ecc

In questo modo le pagine vengono ricostruite con una join (in realta' nel vb viene fatto con una select, per motivi di prestazioni).

__________________
icq: 57553717 - mail: mino@ngi.it - web: www.minux.it - Fattori Arcani

25-03-2004 13:09
Click Here to See the Profile for Mino Click Here to See the Blog of Mino Visit Mino's homepage! Find more posts by Mino Add Mino to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Hamelin
.pifferaio.magico.

User info:
Registered: Feb 2003
Posts: 662 (0.08 al dì)
Location: ..tra i monti intorno ad Hamelin..
Corso: Ingegneria Informatica
Anno:
Time Online: 7 Days, 7:19:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by korn
- se il valore è 0 significa che quel post è l'inizio di un thread

- se il valore non è 0 significa che quel post è una risposta ad un thread il cui ID è il valore stesso
Ma poi per visualizzare il topic devo fare una query più complicata, no? Non è meglio ch'io copi anche nei post iniziali l'id_thread corrispettivo? Se uso una sola tabella non posso far altro che usare l'id del post iniziale come id del thread, nevvero?

__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."

25-03-2004 14:34
Click Here to See the Profile for Hamelin Click here to Send Hamelin a Private Message Visit Hamelin's homepage! Find more posts by Hamelin Add Hamelin to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
korn
SET FIRE!

User info:
Registered: Jun 2002
Posts: 5793 (0.69 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Hamelin
Ma poi per visualizzare il topic devo fare una query più complicata, no? Non è meglio ch'io copi anche nei post iniziali l'id_thread corrispettivo? Se uso una sola tabella non posso far altro che usare l'id del post iniziale come id del thread, nevvero?


Macché complicazioni! :)

Per ottenere l'elenco dei thread usa questa:

SELECT * FROM tabella_post WHERE ID_THREAD = 0 ORDER BY ID DESC

("DESC" te li ordina dal più nuovo al più vecchio, se non metti "DESC" te li ordina dal più vecchio al più nuovo)

Per leggere un thread usa questa:

SELECT * FROM tabella_post WHERE ID = valore OR ID_THREAD = valore ORDER BY ID

(senza DESC stavolta, perché vanno in ordine cronologico ovviamente... quindi verrà prima il post iniziale e poi tutte le risposte nell'ordine in cui sono state postate)

:)

__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.

25-03-2004 15:13
Click Here to See the Profile for korn Click Here to See the Blog of korn Click here to Send korn a Private Message Visit korn's homepage! Find more posts by korn Add korn to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Hamelin
.pifferaio.magico.

User info:
Registered: Feb 2003
Posts: 662 (0.08 al dì)
Location: ..tra i monti intorno ad Hamelin..
Corso: Ingegneria Informatica
Anno:
Time Online: 7 Days, 7:19:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

C'hai raggione di brutto!! Grazie mille, korn...

__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."

25-03-2004 15:17
Click Here to See the Profile for Hamelin Click here to Send Hamelin a Private Message Visit Hamelin's homepage! Find more posts by Hamelin Add Hamelin to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
AlphaGamma
.piano ma pieni.

User info:
Registered: Jun 2002
Posts: 6732 (0.81 al dì)
Location:
Corso: Eh?
Anno: Io cosa?
Time Online: 21 Days, 21:22:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

L'ho sempre detto Korn che sei un figo! :)
A cosa ci serve il Vbulletin? C'è Korn... :D

__________________
Attenzio', concentrazio', ritmo e VITALITÀ

25-03-2004 15:36
Click Here to See the Profile for AlphaGamma Click Here to See the Blog of AlphaGamma Click here to Send AlphaGamma a Private Message Visit AlphaGamma's homepage! Find more posts by AlphaGamma Add AlphaGamma to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Hamelin
.pifferaio.magico.

User info:
Registered: Feb 2003
Posts: 662 (0.08 al dì)
Location: ..tra i monti intorno ad Hamelin..
Corso: Ingegneria Informatica
Anno:
Time Online: 7 Days, 7:19:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Question File di sessione...

Ma i file delle varie sessioni PHP vengono cancellati automaticamente dai servizi di hosting?

Chiedo perché, provando in locale, mi rimangono e intasano il mio hd (...solo qualche byte... :asd: )...

Oppure c'è un modo per usare session_destroy() quando un utente chiude il browser? (...come sarebbe possibile?)

Denghiu for anzuers...

__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."

17-04-2004 13:43
Click Here to See the Profile for Hamelin Click here to Send Hamelin a Private Message Visit Hamelin's homepage! Find more posts by Hamelin Add Hamelin to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
holylaw
.grande:maestro.

User info:
Registered: Feb 2003
Posts: 3142 (0.39 al dì)
Location: milano
Corso: Magistrale Informatica
Anno: bella domanda
Time Online: 88 Days, 5:30:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

io sapevo che le sessioni venivano distrutte automaticamente quano si chiude il browser......

__________________
La mia epoca ed io non siamo fatti l'uno per l'altro:questo è chiaro. Ma è da vedere chi di noi due vincerà il processo di fronte al tribunale dei posteri.
AV MJØDEN VART DU VIS OG KLOK, SÅ DREKKA MER!!!!
Le persone sagge parlano perché hanno qualcosa da dire.
Le persone sciocche perché hanno da dire qualcosa.

17-04-2004 14:05
Click Here to See the Profile for holylaw Click Here to See the Blog of holylaw Click here to Send holylaw a Private Message Find more posts by holylaw Add holylaw to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Hamelin
.pifferaio.magico.

User info:
Registered: Feb 2003
Posts: 662 (0.08 al dì)
Location: ..tra i monti intorno ad Hamelin..
Corso: Ingegneria Informatica
Anno:
Time Online: 7 Days, 7:19:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Sì, lo so... ma sul mio pc non è così!...mah...

__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."

17-04-2004 14:52
Click Here to See the Profile for Hamelin Click here to Send Hamelin a Private Message Visit Hamelin's homepage! Find more posts by Hamelin Add Hamelin to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
korn
SET FIRE!

User info:
Registered: Jun 2002
Posts: 5793 (0.69 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

La sessione dovrebbe chiudersi automaticamente dopo che è passato, dalla chiusura del browser o dall'uscita dal sito, il tempo di "timeout" impostato per gli script.

__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.

17-04-2004 15:07
Click Here to See the Profile for korn Click Here to See the Blog of korn Click here to Send korn a Private Message Visit korn's homepage! Find more posts by korn Add korn to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Hamelin
.pifferaio.magico.

User info:
Registered: Feb 2003
Posts: 662 (0.08 al dì)
Location: ..tra i monti intorno ad Hamelin..
Corso: Ingegneria Informatica
Anno:
Time Online: 7 Days, 7:19:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Grazie korn!

__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."

17-04-2004 19:11
Click Here to See the Profile for Hamelin Click here to Send Hamelin a Private Message Visit Hamelin's homepage! Find more posts by Hamelin Add Hamelin to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 11:54.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.153 seconds (57.71% PHP - 42.29% MySQL) con 27 query.