PHP: sto diventando matto!

Php, PHP-Nuke, phpBB, Html, CSS, Javascript e tutto ciò che concerne la gestione siti web.
asgl
Nuovo utente
Nuovo utente
Messaggi: 10
Iscritto il: 13/09/2003, 13:40

PHP: sto diventando matto!

Messaggio da asgl »

allora, ho fatto un piccolo script:
mi da errore nella linea 5, ma nn capisco dove sta! me lo correggete x faovre?

Codice: Seleziona tutto

<?php 
function main() {echo"NESSUNA FUNZIONE SELEZIONATA!"
 ."";
};
function file01() { include './download_accelerator_plus.htm'};
function file02() { include './icqlite.htm' };
function file03() { include './ie6SP1.htm'};
function file04() { include './MSNMessenger.htm' };
switch($file_id) {

    default:
    main();
    break;
    
    case "02":
    file02();
    break;
	
	case "03":
    file03();
    break;
	
    case "04":
    file04();
    break;
	
};
?>
Avatar utente
AleSSaNDRo
WebMaster
WebMaster
Messaggi: 2358
Iscritto il: 24/04/2003, 1:11
Località: Milano

Messaggio da AleSSaNDRo »

Codice: Seleziona tutto

<?php

switch($file_id) {
	default:
		echo "NESSUNA FUNZIONE SELEZIONATA!"; break;
	case "01":
		include ("../download_accelerator_plus.htm"); break;
	case "02":
		include ("../icqlite.htm"); break;
	case "03":
		include ("../ie6SP1.htm"); break;
	case "04":
		include ("../MSNMessenger.htm"); break;
};

?>
inutile creare 5 funzioni....
asgl
Nuovo utente
Nuovo utente
Messaggi: 10
Iscritto il: 13/09/2003, 13:40

Messaggio da asgl »

'azie
asgl
Nuovo utente
Nuovo utente
Messaggi: 10
Iscritto il: 13/09/2003, 13:40

Messaggio da asgl »

comunque dove era l'errore nel mio?
Avatar utente
Giacomo
Staff - Tecnico
Staff - Tecnico
Messaggi: 477
Iscritto il: 24/04/2003, 21:20
Località: Milano

Messaggio da Giacomo »

E' inutile creare 5 funzioni :wink: :mrgreen:
- Staff tecnico -
flanza
Utente giovane
Utente giovane
Messaggi: 25
Iscritto il: 24/01/2004, 19:09

R: PHP: sto diventando matto!

Messaggio da flanza »

L'errore consiste nella mancanza di alcuni punti e virgola:

Se si corregge in questo modo:

<?php
function main() {echo"NESSUNA FUNZIONE SELEZIONATA!"
."";
};
function file01() { include './download_accelerator_plus.htm';};
function file02() { include './icqlite.htm' ;};
function file03() { include './ie6SP1.htm';};
function file04() { include './MSNMessenger.htm';};
switch($file_id) {

default:
main();
break;

case "02":
file02();
break;

case "03":
file03();
break;

case "04":
file04();
break;

};
?>

vedi che funziona!

Chi c’è in linea

Visitano il forum: Nessuno e 0 ospiti