querie probleempjeuh

Gestart doorRogier13 reacties34 weergaven

14 berichten · pagina 1 van 1

Rogier

Lid · Topicstarter

Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hey jongens,

ik heb klein probleempje, iemand enig idee wat er fout is?

[COLOR= #0000BB]<?php 

$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$tekst[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]];[/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]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `paginas` 
                SET `tekst` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tekst[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" AND `titel` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$titel[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" 
                WHERE `naam` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/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= #0000BB]$query[/COLOR][COLOR= #007700];[/COLOR]
?>


die mysql_error geeft geen output, dus daar krijg ik niks van sadley
De enige reden waarom het niet werkt, is dat het in de database niet veranderd.

alvast bedankt smile
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php 

$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$tekst[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]];[/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]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `paginas` 
                SET `tekst` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tekst[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" AND `titel` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$titel[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" 
                WHERE `naam` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/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]
?>
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Freestyle schreef:
[COLOR= #0000BB]<?php 

$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$tekst[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]];[/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]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `paginas` 
                SET `tekst` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tekst[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" AND `titel` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$titel[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" 
                WHERE `naam` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/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]
?>
Denk jij echt dat variable en echo weghalen werkt?
Dit kan echt aan zoveel liggen, dump je database structuur eens.
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Alemaalte schreef:
Eerdere citaten tonen
Freestyle schreef:
[COLOR= #0000BB]<?php 

$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$tekst[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]];[/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]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `paginas` 
                SET `tekst` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tekst[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" AND `titel` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$titel[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" 
                WHERE `naam` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/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]
?>
Denk jij echt dat variable en echo weghalen werkt?
Dit kan echt aan zoveel liggen, dump je database structuur eens.

Het was meer dat de query gewoon gelemaal tussen de {} zit.
Je kan ook de echo tussen de {} verplaatsenemo
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Staat er ergens error reporting uit in je script of op de server?
0
Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
De request_method is waarschijnlijk niet gelijk aan POST. Staat er verder wel ergens
0
Rogier

Lid · Topicstarter

Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey jongens,

Ik heb het fout omschreven hij plaatst nu wel iets in de db, maar dat is een 0 bij tekst en niks ( geen verandering bij titel)

Structuur is: paginas: id, naam, tekst, titel ennogmeeronbelangrijke dingen...

Error reporting staat niet uit en de POST klopt.

Iemand nog suggesties?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Naam, heeft dat INT of VARCHAR of iets anders? Als je tekst insert bij INT word dit 0.

Dus de database types zijn geen "ennogmeeronbelangrijke dingen..." maar dat zijn redelijk belangrijke dingen om de querys juist te laten werken.
0
Rogier

Lid · Topicstarter

Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
naam is VARCHAR 100, titel is VARCHAR 150, tekst is TEXT

Die zijn wel onbelangrijk want die hebben niks met dit script te maken.
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
IN een update query moet je , gebruiken om meerdere velden te updaten. Heeft niks met Varchar ofzo te maken emo
[COLOR= #0000BB]<?php 

$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$tekst[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]];[/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]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `paginas` 
                SET `tekst` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tekst[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]", `titel` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$titel[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" 
                WHERE `naam` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/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= #0000BB]$query[/COLOR][COLOR= #007700];[/COLOR]
?>


Ik zou overigens wel een Mysql_escape erop gooien
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Milan schreef:
IN een update query moet je , gebruiken om meerdere velden te updaten. Heeft niks met Varchar ofzo te maken emo
[COLOR= #0000BB]<?php 

$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$tekst[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]];[/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]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `paginas` 
                SET `tekst` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tekst[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]", `titel` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$titel[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" 
                WHERE `naam` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/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= #0000BB]$query[/COLOR][COLOR= #007700];[/COLOR]
?>


Ik zou overigens wel een Mysql_escape erop gooien

Het zou er wel mee te maken kunnen hebben smile
0
Rogier

Lid · Topicstarter

Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het klopt! Bedankt!

Er zaten eerst wat andere fouten in die ik er samen met Marijn heb uitgehaald, hij dacht dat je juist AND moest gebruiken. Maakt niet uit. maarja

Hartstikke bedenk iig!
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rogier schreef:
Het klopt! Bedankt!

Er zaten eerst wat andere fouten in die ik er samen met Marijn heb uitgehaald, hij dacht dat je juist AND moest gebruiken. Maakt niet uit. maarja
Hartstikke bedenk iig!

Haha ik las het en dacht bloosbloosbloosbloosMaar dan heb ik ook iets nieuws geleerd.
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Gebruik mysql_real_escape_string() voor je inputs anders is je db in 10 seconden neer te halen
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