mysql / php vraag

Gestart doorRohimma8 reacties35 weergaven

9 berichten · pagina 1 van 1

Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik weet niet wat hier fout is...
kan iemand mij helpen?

(hij geeft aan dat de fout zit op lijn 10)
dit is de code:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/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]x[/COLOR][COLOR= #007700]])); 
    {[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO gastenboek (naam, email, vraag) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vraag[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]") or die(mysql_error());
        echo Uw vraag is verstuurt!;
    }
else 
    {
        echo <form method="[/COLOR]post[COLOR= #DD0000]" action="">;
        echo <table border="[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #DD0000]">;
        echo <tr>;
        echo <td>Uw naam:</td>;
        echo <td><input type="[/COLOR]text[COLOR= #DD0000]" name="[/COLOR]naam[COLOR= #DD0000]"></td>;
        echo </tr>;
        echo <tr>;
        echo <td>Uw e-mail adres:</td>;
        echo <td><input type="[/COLOR]text[COLOR= #DD0000]" name="[/COLOR]email[COLOR= #DD0000]"></td>;
        echo </tr>;
        echo <tr>;
        echo <td>Uw vraag:</td>;
        echo <td><TEXTAREA NAME="[/COLOR]vraag[COLOR= #DD0000]" ROWS="[/COLOR][COLOR= #0000BB]5[/COLOR][COLOR= #DD0000]" COLS="[/COLOR][COLOR= #0000BB]50[/COLOR][COLOR= #DD0000]"></TEXTAREA></td>;
        echo </tr>;
        echo <tr>;
        echo <td>&nbsp;</td>;
        echo <td><input type="[/COLOR]submit[COLOR= #DD0000]" value="[/COLOR]Verstuur[COLOR= #DD0000]" name="[/COLOR]x"[COLOR= #007700]><[/COLOR]/td[COLOR= #007700]>[/COLOR][COLOR= #DD0000];
        echo [/COLOR][COLOR= #007700]<[/COLOR]/tr[COLOR= #007700]>[/COLOR][COLOR= #DD0000];
        echo [/COLOR][COLOR= #007700]<[/COLOR]/form[COLOR= #007700]>[/COLOR][COLOR= #007700];
    }[/COLOR]
[URL="http://www.php.net/mysql_close"]mysql_close[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
?>


(ik ben een beginner met php/mysql)
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/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]x[/COLOR][COLOR= #007700]]))
    {[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO gastenboek (naam, email, vraag) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vraag[/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]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Uw vraag is verstuurt![/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]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table border="0">[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td>Uw naam:</td>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td><input type="text" name="naam"></td>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td>Uw e-mail adres:</td>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td><input type="text" name="email"></td>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td>Uw vraag:</td>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td><TEXTAREA NAME="vraag" ROWS="5" COLS="50"></TEXTAREA></td>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td>&nbsp;</td>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td><input type="submit" value="Verstuur" name="x"></td>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</form>[/COLOR][COLOR= #007700];
    }[/COLOR]
[URL="http://www.php.net/mysql_close"]mysql_close[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
nu komt het wel te voorschijn maar staat er boven het formulier:

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/rohimma/domains/rohimma.s2.one2xs.com/public_html/testscrip/index.php on line 30
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rohimma schreef:
nu komt het wel te voorschijn maar staat er boven het formulier:

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/rohimma/domains/rohimma.s2.one2xs.com/public_html/testscrip/index.php on line 30
Haal uberhaubt mysql_close dr uit yummieals je hem wel wil gebruiken zet hem dan onder de query
0
Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik heb het er uit gehaald en nu geeft hij de error niet meer

hij geeft nu wel deze error aan als ik op verstuur druk:

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 at line 1
0
Berichten
1.916
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Vervang regel 5 door:

mysql_query("INSERT INTO gastenboek (naam, email, vraag) VALUES (".$_POST[naam].", ".$_POST[email].", ".$_POST[vraag]."")") or die(mysql_error());
0
Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
die error is weg maar krijg nu:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/rohimma/domains/rohimma.s2.one2xs.com/public_html/testscrip/index.php on line 10

(ps index.php ziet er nu zo uit: )
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/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]x[/COLOR][COLOR= #007700]]))
    {[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO gastenboek (naam, email, vraag) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vraag[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR][COLOR= #DD0000]") or die(mysql_error());
        echo Uw vraag is verstuurt!;
    }
else
    {
        echo <form method="[/COLOR]post[COLOR= #DD0000]" action="">;
        echo <table border="[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #DD0000]">;
        echo <tr>;
        echo <td>Uw naam:</td>;
        echo <td><input type="[/COLOR]text[COLOR= #DD0000]" name="[/COLOR]naam[COLOR= #DD0000]"></td>;
        echo </tr>;
        echo <tr>;
        echo <td>Uw e-mail adres:</td>;
        echo <td><input type="[/COLOR]text[COLOR= #DD0000]" name="[/COLOR]email[COLOR= #DD0000]"></td>;
        echo </tr>;
        echo <tr>;
        echo <td>Uw vraag:</td>;
        echo <td><TEXTAREA NAME="[/COLOR]vraag[COLOR= #DD0000]" ROWS="[/COLOR][COLOR= #0000BB]5[/COLOR][COLOR= #DD0000]" COLS="[/COLOR][COLOR= #0000BB]50[/COLOR][COLOR= #DD0000]"></TEXTAREA></td>;
        echo </tr>;
        echo <tr>;
        echo <td>&nbsp;</td>;
        echo <td><input type="[/COLOR]submit[COLOR= #DD0000]" value="[/COLOR]Verstuur[COLOR= #DD0000]" name="[/COLOR]x"[COLOR= #007700]><[/COLOR]/td[COLOR= #007700]>[/COLOR][COLOR= #DD0000];
        echo [/COLOR][COLOR= #007700]<[/COLOR]/tr[COLOR= #007700]>[/COLOR][COLOR= #DD0000];
        echo [/COLOR][COLOR= #007700]<[/COLOR]/form[COLOR= #007700]>[/COLOR][COLOR= #007700];
    }[/COLOR]

?>
0
Berichten
1.916
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heb iets over het hoofd gezien, vervang regel 5 nog eens door dit:

mysql_query("INSERT INTO gastenboek (naam, email, vraag) VALUES (".$_POST[naam].", ".$_POST[email].", ".$_POST[vraag].")") or die(mysql_error());
0
Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
het werkt bedankt allemaal
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