Syntax error

Gestart doorJesper52 reacties145 weergaven

53 berichten · pagina 3 van 4

Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Als ik dit heb:

[COLOR= #0000BB]<?php[/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]id[/COLOR][COLOR= #007700]])){[/COLOR]
  
 
 [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><font color="red"><b>Log in om deze pagina te bekijken</b></font>[/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
?>

    <form method="post">
        <p>
            Word:<br />
            <textarea id="editor1" name="editor1"></textarea>
            <script type="text/javascript">
                CKEDITOR.replace( editor1 );
            </script>
        </p>
        <p>
            <input type="submit" value="Sla op!" />
        </p>
    </form>


[COLOR= #0000BB]<?php[/COLOR]

[COLOR= #007700]}[/COLOR]

?>


Hoe doe ik dan als er iets instaat en je drukt op sla op dat het dan in database komt, Database heet: wordpad

toevoeging op 7 januari 2012, 21:43:13:
Table heet wordpad en ik bedoel met instert into wordpad
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
$_POST["editor1"] meer zeg ik niet emo
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
http://www.manxi.nl/HELP%20ME%20NOU.png

Vond het een grappige url xd
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Je hebt ID wel auto_increment, maar het is geen primary key (staat bij "Index")
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ohja dom en nog iets

Notice: Undefined variable: username in /home/uploaden/domains/project.s1.one2xs.com/public_html/pages/word.php on line 25

Notice: Undefined index: editor1 in /home/uploaden/domains/project.s1.one2xs.com/public_html/pages/word.php on line 29
Column count doesnt match value count at row 1

[COLOR= #0000BB]<?php[/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]id[/COLOR][COLOR= #007700]])){[/COLOR]
  
 
 [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><font color="red"><b>Log in om deze pagina te bekijken</b></font>[/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
?>

    <form method="post">
        <p>
            Word:<br />
            <textarea id="editor1" name="editor1"></textarea>
            <script type="text/javascript">
                CKEDITOR.replace( editor1 );
            </script>
        </p>
        <p>
            <input type="submit" value="Sla op!" />
        </p>
    </form>

[COLOR= #0000BB]<?php
$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE username = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$username[/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]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]);[/COLOR]


[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO wordpad VALUES (NULL,1,"[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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]$uFetch[/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]"editor1"[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",0,NOW(),Punten ontvagen!);"[/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]<?php[/COLOR]

[COLOR= #007700]}[/COLOR]

?>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Komop zeg... De errors geven zelf al aan wat er fout is. De volgende keer dat je weer zon basisvraag stelt help ik je niet meer

Error 1: $username bestaat niet.

Error 2: $_POST["editor1"] is niet aangemaakt (je hebt niet gecheckt of de form gepost is)

Error 3: Je insert query klopt niet.
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
En bedankt smile
toevoeging op 7 januari 2012, 22:55:14:
Je mag hier niks vragen als je php leert frown
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jespar schreef:
En bedankt smile
toevoeging op 7 januari 2012, 22:55:14:
Je mag hier niks vragen als je php leert frown
Mag wel, maar dergelijke foutjes lijken me wel duidelijk.

PS. Ald je PHP leert gebruik dan zeker w3schools.com wink
toevoeging op 7 januari 2012, 23:20:01:
Jespar schreef:
Hoe kan ik een textbox van ckeditor er op zetten, leggen ze ook niet even uit op de site he -,-
Ik ver moed dat er bij de download wel voorbeeld (example) zit redface
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb het al gevraagt op phphulp en daar helpen ze me met plezier emo
0
Fass

Lid

Berichten
3.771
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nou, pff, heb hem een beetje uit de brand geholpen smile.
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Wij helpen je hier ook met alle plezier, maar niet als je telkens weer met errors komt die zichzelf uitleggen. Dan mag je ook zelf wel een beetje moeite doen.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Jespar schreef:
Ik heb het al gevraagt op phphulp en daar helpen ze me met plezier emo
Die emo-smilie kan je weghalen. Ze helpen je met plezier, maar het is wel zo slim om zelf ook eens wat met de gegeven adviezen daar te doen.

Wel vreemd dat je dan nog zegt dat ze je niet helpen.

maar goed: Om even behulpzaam te zijn:

if($_SERVER[REQUEST_METHOD]=="POST") {
//formulier verstuurd
} else {
// toon je formulier
}


Als je dit op de juiste plaats in je script zet en het lichtelijk aanpast, dan moet het werken.
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe kan ik het veiligst iets uit de database halen en dan op de pagina showen?
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Met strip tags, mysql_(real_)escape_strings, en htmlspecialchars. Moet je maar even googlen wink
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
EDIT: opgelost maar hoe doe ik dat hij er 5 ziet en niet 1

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]//////////////////
// CONTACT BEHEER
// MADE BY: JESPER[/COLOR]

[COLOR= #007700]}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]contact[/COLOR][COLOR= #007700]])){[/COLOR]

    [COLOR= #0000BB]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM contact ORDER BY id DESC LIMIT 5"[/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]$uFetcha[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Naam<br>[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetcha[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]));[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Email<br>[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetcha[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]));[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Ondwerp<br>[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetcha[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]topic[/COLOR][COLOR= #007700]]));[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Bericht<br>[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetcha[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]message[/COLOR][COLOR= #007700]]));[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]IP<br>[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetcha[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ip[/COLOR][COLOR= #007700]]));[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><br><br><br>[/COLOR][COLOR= #007700];[/COLOR]


    

[COLOR= #FF8000]// CONTACT BEHEER
// MADE BY: JESPER
///////////////////[/COLOR]
?>
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