PHP/MySQL Probleem

Gestart doorJosnl5 reacties36 weergaven

6 berichten · pagina 1 van 1

Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waarom werkt dit niet?

[COLOR= #0000BB]<?php[/COLOR]
  
   [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ===[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700]) 
    {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]) ||[/COLOR] [URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]) 
        {[/COLOR] 

            [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je bent je gebruikersnaam vergeten in te vullen.[/COLOR][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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]) ||[/COLOR] [URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]) 
        {[/COLOR] 
            [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je bent vergeten je wachtwoord in te vullen. (Let ook op de controle!)[/COLOR][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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]) ||[/COLOR] [URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]) 
        {[/COLOR] 
            [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je bent vergeten je email adres in te vullen.[/COLOR][COLOR= #007700]; 
        }[/COLOR] 
       
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]) 
            {[/COLOR] 
                                     [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/COLOR] 
  
  [COLOR= #0000BB]$insert[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #DD0000]"INSERT INTO ledensysteem (username,password,pass_controle,email,email_controle) VALUES 
                          "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", 
                          "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", 
                          "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass_controle[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", 
                          "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
                          "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email_controle[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700]);[/COLOR]      

  [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$insert[/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]
  
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je bent succesvol ingelogd, je word nu doorgestuurd naar de startpagina!"[/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]De volgende fouten zijn opgetreden: 
                     <br /> 
                     <br /> 
                     <ul>[/COLOR][COLOR= #007700];[/COLOR] 

                     [URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$melding[/COLOR][COLOR= #007700]) 
                     {[/COLOR] 
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font color="#FF0000"><li>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$melding[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]</li></font>[/COLOR][COLOR= #007700]; 
                     }[/COLOR] 
                      
                                      [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</ul> 
                     <br /> 
                     <br />[/COLOR][COLOR= #007700];[/COLOR] 
                 

                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form method="POST" action="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]php_self[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"> 
               <table border="0"> 
               <tr> 
                   <td>Gebruikersnaam:</td> 
                   <td><input type="text" name="username" size="30px" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" /></td> 
               </tr> 
              
               <tr> 
                   <td>Wachtwoord:</td> 
                   <td><input type="password" name="password" size="30px" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" /></td> 
               </tr> 
               <tr> 
                   <td>Wachtwoord (controle):</td> 
                   <td><input type="password" name="pass_controle" size="30px" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass_controle[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" /></td> 
               </tr> 
               <tr> 
                   <td>E-mail:</td> 
                   <td><input type="text" name="email" size="30px" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" /></td> 
                   <tr> 
                   <td>E-mail (controle):</td> 
                   <td><input type="text" name="email_controle" size="30px" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email_controle[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" /></td> 
               </tr> 
               </tr> 
               <tr> 
          </table> 
          <input type="submit" name="submit" value="Registreren" /><input type="reset" value="Resetten" /> 
          </form>[/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]<form method="POST" action="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]php_self[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"> 
               <table border="0"> 
               <tr> 
                   <td>Gebruikersnaam:</td> 
                   <td><input type="text" name="username" size="30px" /></td> 
               </tr> 
              
               <tr> 
                   <td>Wachtwoord:</td> 
                   <td><input type="password" name="password" size="30px" /></td> 
               </tr> 
               <tr> 
                   <td>Wachtwoord (controle):</td> 
                   <td><input type="password" name="pass_controle" size="30px" /></td> 
               </tr> 
               <tr> 
                   <td>E-mail:</td> 
                   <td><input type="text" name="email" size="30px" /></td> 
                   <tr> 
                   <td>E-mail (controle):</td> 
                   <td><input type="text" name="email_controle" size="30px" /></td> 
               </tr> 
               </tr> 
               <tr> 
          </table> 
          <input type="submit" name="submit" value="Registreren" /><input type="reset" value="Resetten" /> 
          </form>[/COLOR][COLOR= #007700]; 
    }[/COLOR]      


?>


Ik krijg deze error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ougougo, iggi, igigu at line 2


Op die brabbeltekst moet je niet letten, dat is wat ik ingevuld heb in het form.wink
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
De fout is?
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
En het probleem is?
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
je hebt om de values geen ( en ) staan

$insert = ("INSERT INTO ledensysteem (username,password,pass_controle,email,email_controle) VALUES 
                          " . mysql_real_escape_string($_POST[username]) . ", 
                          " . mysql_real_escape_string($_POST[password]) . ", 
                          " . mysql_real_escape_string($_POST[pass_controle]) . ", 
                          " . mysql_real_escape_string($_POST[email]) . ",
                          " . mysql_real_escape_string($_POST[email_controle]) . " ");      

  $sql = mysql_query($insert) or die(mysql_error());


wordt dan:

$insert = ("INSERT INTO ledensysteem (username,password,pass_controle,email,email_controle) VALUES ( 
                          " . mysql_real_escape_string($_POST[username]) . ", 
                          " . mysql_real_escape_string($_POST[password]) . ", 
                          " . mysql_real_escape_string($_POST[pass_controle]) . ", 
                          " . mysql_real_escape_string($_POST[email]) . ",
                          " . mysql_real_escape_string($_POST[email_controle]) . " )");      

  $sql = mysql_query($insert) or die(mysql_error());
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dankjewel Rik, nu werkt het! biggrin
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Geen probleem ^^
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