php t_else

Gestart doorPropje5 reacties56 weergaven

6 berichten · pagina 1 van 1

Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo ik ben bezig met bestel producten heb nu dus dit:

[COLOR= #0000BB]<?php[/COLOR]
                    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$fout[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<b>Er zijn [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fout[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] fouten opgetreden: </b><br />[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
     }[/COLOR]
    [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$login[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]];[/COLOR]
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"hash"[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"REMOTE_ADDR"[/COLOR][COLOR= #007700]]);[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U bent succesvol ingelogd.<br /> u wordt doorgewezen of Klik <a href="/leden">hier</a> om gelijk door te gaan[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<meta http-equiv="refresh" content="30; URL=http://www.zubein.webuda.com/leden">[/COLOR][COLOR= #007700];
    
}[/COLOR][URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]]) &&[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"hash"[/COLOR][COLOR= #007700]] ==[/COLOR] [URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"REMOTE_ADDR"[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$gebruikersQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM webhost WHERE id_gebruikersnaam = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersQuery[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]zichtbaar[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p class="ttt">Bestelde hosts</p>[/COLOR][COLOR= #007700];[/COLOR]  
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR]    
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table>
    <tr>
                <td width="25%"><b>Naam:</b></td>
        <td width="23%"><b>Pakket:</b></td>
        <td width="22%"><b>Server:</b></td>
                <td width="24%"><b>Status:</b></td>
    </tr>
        <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id_gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
                </td>
        <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pakket[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
        <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]server[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
                <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]status[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
    </tr>
        <tr>
        <td colspan="4" style="text-align:center">
    </tr>
}
</table><br>[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p class="ttt">Bestelde hosts</p>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt nog geen webhost[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Uw bent niet ingelogd![/COLOR][COLOR= #007700];
}
}[/COLOR]
?>


maar krijg deze fout:

Parse error: syntax error, unexpected T_ELSE in /home/a2829566/public_html/leden/besteld.php on line 134
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Tip: lijn je code gewoon goed uit, dan zie je zulke dingen in één oogopslag en hoef je niet urenlang haakjes te gaan zitten tellen.
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Script jij in kladblok? Want stop daar dan onmidelijk mee! download notepad++ gratis en je ziet dat soort zaken meteen.
En geef ons alles yummieDit kan door een foute { komen een foute } een fout if, een foute else, etc.
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Op de laatste lijn moet } weg en moet volgens mij niet boven de laatste else
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$fout[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) 
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<b>Er zijn [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fout[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] fouten opgetreden: </b><br />[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$login[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) 
{[/COLOR]
    [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"hash"[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"REMOTE_ADDR"[/COLOR][COLOR= #007700]]);[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U bent succesvol ingelogd.<br /> u wordt doorgewezen of Klik <a href="/leden">hier</a> om gelijk door te gaan[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<meta http-equiv="refresh" content="30; URL=http://www.zubein.webuda.com/leden">[/COLOR][COLOR= #007700];    
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] 
[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]]) &&[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"hash"[/COLOR][COLOR= #007700]] ==[/COLOR] [URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"REMOTE_ADDR"[/COLOR][COLOR= #007700]])) {[/COLOR]
        [COLOR= #0000BB]$gebruikersQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM webhost WHERE id_gebruikersnaam = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        [COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersQuery[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]zichtbaar[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700])
            {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p class="ttt">Bestelde hosts</p>[/COLOR][COLOR= #007700];[/COLOR]  
                [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR]    
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table>
                    <tr>
                        <td width="25%"><b>Naam:</b></td>
                        <td width="23%"><b>Pakket:</b></td>
                        <td width="22%"><b>Server:</b></td>
                        <td width="24%"><b>Status:</b></td>
                    </tr>
                     // mist een <tr> ??
                        <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id_gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
                        </td>
                        <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pakket[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
                        <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]server[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
                        <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]status[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
                    </tr>
                    <tr>
                        <td colspan="4" style="text-align:center">
                    </tr>[/COLOR][COLOR= #007700];
                }[/COLOR]
                
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table><br>[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Waarom gebruik je een echo door een while heen en daarna nog steeds ? Dan echo je natuurlijk ook de }[/COLOR]
            
            [COLOR= #007700]}[/COLOR]
            [URL="http://www.php.net/else"]else[/URL] 
            [COLOR= #007700]{[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p class="ttt">Bestelde hosts</p>[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// je kan voor titels beter gebruik maken van <h tags[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt nog geen webhost[/COLOR][COLOR= #007700];
            }[/COLOR]
        [COLOR= #FF8000]// de if wordt niet gesloten?[/COLOR]
        [URL="http://www.php.net/else"]else[/URL] 
        [COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Uw bent niet ingelogd![/COLOR][COLOR= #007700];
        }
    }[/COLOR]
[COLOR= #FF8000]// de eerste else wordt niet gesloten?[/COLOR]
?>


Voortaan zo uitlijnen! opmerkingen staan in script
0
Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hij doet het nu alleen geeft die dus aan dat er geen webhost zijn in de db staat zichtbaar op 1 dus zal die wel de while aan moeten roepen

}
            else
            {
                echo <p class="ttt">Bestelde hosts</p>; // je kan voor titels beter gebruik maken van <h tags
                echo Je hebt nog geen webhost;
            }
        }


owja ik zal ff notepad++ download
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren