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. > Didattica > Corsi A - F > Basi di dati ~ informatica triennale > [Progetto] "Blog" Thread Rating: 1 votes, 4.00 average.
Pages (33): « First ... « 22 23 24 25 [26] 27 28 29 30 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.07 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

devi usare la fopen...

$fp = fopen("f:".$percorso,rb);
fseek($fp,2); //Mi posiziono al 2° carattere
$prova = fread($fp,50); //Leggo 50 caratteri partendo dalla posizione corrente
echo ("$prova");
fclose($fp);
echo ($percorso);
readfile("F:/Blog/file/".$name);

devi fare una cosa simile...

qui spiega bene: http://us3.php.net/manual/it/function.fopen.php

11-04-2007 20:36
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bledar
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 256 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 6 Days, 3:07:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

non ho capito perche si deve usare fopen
se il file e sul server , basta avere il percorso e lo visualizzi direttamente nel browser che sense ha fare foopen etc?
io ho caricato i file nel db , prima di visualizzare i file li "scarico" dal db mi prendo il percorso e utilizzo un iframe per metter dentro il file se e un file di testo e una tag img se e un immagine
perche fare fopen etcetc?
per qunato riguardo la modifica , carico semplicemente un altro file nel db e sostisuisco l'id del file che ho caricat con quello del file che devo modificare

11-04-2007 20:42
Click Here to See the Profile for bledar Click here to Send bledar a Private Message Find more posts by bledar Add bledar to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ponte
.amico.

User info:
Registered: Jan 2005
Posts: 39 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 1 Day, 5:10:37 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

io li salvo nella cartella htdocs/upload_cont di apache.giusto?

11-04-2007 20:43
Click Here to See the Profile for ponte Click here to Send ponte a Private Message Find more posts by ponte Add ponte to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ponte
.amico.

User info:
Registered: Jan 2005
Posts: 39 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 1 Day, 5:10:37 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

quindi una volta salvati nel mio server i file ...mi salvo il percorso nel db e poi li apro con iframe o tag ...perfetto fila tutto adesso provo!grazie

11-04-2007 20:49
Click Here to See the Profile for ponte Click here to Send ponte a Private Message Find more posts by ponte Add ponte to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bledar
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 256 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 6 Days, 3:07:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

si dovrebbe funzionare cosi

11-04-2007 20:51
Click Here to See the Profile for bledar Click here to Send bledar a Private Message Find more posts by bledar Add bledar to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.07 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

inizialmente avevo fatto così e dai miei ricordi li visualizzava, adesso non uso + quel codice ma salvo il file nel db...

gli iframe vedo che sono comodi, peccato non averli conosciuti prima

11-04-2007 20:52
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
elcuchu
.amico.

User info:
Registered: Apr 2007
Posts: 33 (0.00 al dì)
Location: Milano
Corso:
Anno:
Time Online: 5:41:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by ponte
quindi una volta salvati nel mio server i file ...mi salvo il percorso nel db e poi li apro con iframe o tag ...perfetto fila tutto adesso provo!grazie



Io ho fatto cosi e funziona alla grande!!! Se hai problemi chiedimi pure!

Ragazzi datemi una mano non ho ancora capito i trigger, chi mi può far un esempio? per esempio vorrei aggiornare il campo articoli_inseriti della tabella statistiche ogni volta che inserisco un record nella tabella insert_articolo.

Grazie

11-04-2007 21:57
Click Here to See the Profile for elcuchu Click here to Send elcuchu a Private Message Find more posts by elcuchu Add elcuchu to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bledar
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 256 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 6 Days, 3:07:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

io l'ho fatto cosi
CREATE OR REPLACE FUNCTION elements_per_type()
RETURNS "trigger" AS
$BODY$
DECLARE
total integer;
BEGIN
SELECT count(id) into total from content where category=NEW.category;
UPDATE statistics SET n_elements = total WHERE name =NEW.category;
RETURN NEW;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
questa e la funzione
e il trigger
CREATE TRIGGER elements_per_type
AFTER INSERT
ON content
FOR EACH ROW
EXECUTE PROCEDURE elements_per_type();

questo se inserisci contenuti
quando calcelli contenuti
CREATE OR REPLACE FUNCTION elements_per_type_ondelete()
RETURNS "trigger" AS
$BODY$
DECLARE
total integer;
BEGIN
SELECT count(id) into total from content where category=OLD.category;
UPDATE statistics SET n_elements = total WHERE name =OLD.category;
RETURN NEW;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
e il trigger
CREATE TRIGGER elements_per_type_ondelete
AFTER DELETE
ON content
FOR EACH ROW
EXECUTE PROCEDURE elements_per_type_ondelete();
io ho fato cosi e funziona , non so se e il miglior modo ma funziona e questo per il momento momento mi basta

11-04-2007 22:33
Click Here to See the Profile for bledar Click here to Send bledar a Private Message Find more posts by bledar Add bledar to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
elcuchu
.amico.

User info:
Registered: Apr 2007
Posts: 33 (0.00 al dì)
Location: Milano
Corso:
Anno:
Time Online: 5:41:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by bledar

SELECT count(id) into total from content where category=NEW.category;
UPDATE statistics SET n_elements = total WHERE name =NEW.category;


Visto che sei cosi tanto gentile mi spiegheresti queste due righe? ti ringrazio ancora di tutto

11-04-2007 22:50
Click Here to See the Profile for elcuchu Click here to Send elcuchu a Private Message Find more posts by elcuchu Add elcuchu to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bledar
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 256 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 6 Days, 3:07:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

SELECT count(id) into total from content where category=NEW.category;

count(id) --conta tutti i contenuti
into total ---metti queto valore in total
where category=NEW.category;
---dove il tipo di contenuto ovver news imagine o articolo(che io ho chiamato category) e uguale al tipo di contenuto del contenuto apena inserito


UPDATE statistics SET n_elements = total WHERE name =NEW.category;

statistics e la tabella dove tengo le statistice ovver il numero dei elementi pert tipo di contenuto e la media accessi
ed e piu o meno cosi

nome...........n_elementi......media accessi
imagine...........x........................x
articolo............x........................x
news...............x........................x
UPDATE statistics --update della tabella
SET n_elements = total --metti il numero di elementi uguale e total dove total e stato calcolato nella riga sopra cioe SELECT count(id) into total
WHERE name =NEW.category;
dove il tipo di contenuto e uguale a tipo di contenuto apena inserito

Last edited by bledar on 11-04-2007 at 23:05

11-04-2007 22:59
Click Here to See the Profile for bledar Click here to Send bledar a Private Message Find more posts by bledar Add bledar to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
elcuchu
.amico.

User info:
Registered: Apr 2007
Posts: 33 (0.00 al dì)
Location: Milano
Corso:
Anno:
Time Online: 5:41:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Sei stato chiarissimo, grazie infinite

11-04-2007 23:10
Click Here to See the Profile for elcuchu Click here to Send elcuchu a Private Message Find more posts by elcuchu Add elcuchu to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bledar
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 256 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 6 Days, 3:07:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ecco mi e venuto in mente che puoi sostituire le due righe con la seguente
nel caso di insert
UPDATE statistics SET n_elements = n_elements +1 WHERE name =NEW.category;
nel caso di delete
UPDATE statistics SET n_elements = n_elements -1 WHERE name =OLD.category;


questo modo e piu efficente

11-04-2007 23:10
Click Here to See the Profile for bledar Click here to Send bledar a Private Message Find more posts by bledar Add bledar to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.07 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

qualcuno ha fatto l'import/export del profilo in xml??

è difficile?

12-04-2007 13:38
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
elcuchu
.amico.

User info:
Registered: Apr 2007
Posts: 33 (0.00 al dì)
Location: Milano
Corso:
Anno:
Time Online: 5:41:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Devo specificare il where nel trigger che mi aggiorna in numero di modifiche. Io faccio n_mod=n_mod+1 where ? cosa sono old e new, in caso io modifico per esempio il nome del contenuto e scrivo

n_mod=n_mod+1 wherew nome=NEW.nome mi aggiorni le modifiche proprio di quel contenuto?
perchè si scrive return null?

grazie

12-04-2007 15:17
Click Here to See the Profile for elcuchu Click here to Send elcuchu a Private Message Find more posts by elcuchu Add elcuchu to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bledar
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 256 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 6 Days, 3:07:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

beh leggiti un attimo qualcosa su i trigger.
new si riferisce alla tuupla appena insertia o modificata
old alla tupla appena cancellate o modificata
return null perche questa funzione non ritorna nessuna valore fa semplicemente il cambiamento del numero totale di elementi

12-04-2007 15:39
Click Here to See the Profile for bledar Click here to Send bledar a Private Message Find more posts by bledar Add bledar to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 07:38.    Post New Thread    Post A Reply
Pages (33): « First ... « 22 23 24 25 [26] 27 28 29 30 » ... Last »   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.144 seconds (40.24% PHP - 59.76% MySQL) con 23 query.