Maartenl schreef:toevoeging op 3 juni 2012, 11tekst => tekst
En controleer met if("POST" == $_SERVER[REQUEST_METHOD])
+ waar is de button ?
12:geen or die(mysql_error());
De button moet je ff scrollen naar rechts.
Maartenl schreef:toevoeging op 3 juni 2012, 11tekst => tekst
En controleer met if("POST" == $_SERVER[REQUEST_METHOD])
+ waar is de button ?
12:Bjarnootjuh schreef:Had ik niet gezien, sorry.En controleer met if("POST" == $_SERVER[REQUEST_METHOD])Eerdere citaten tonen
Maartenl schreef:tekst => tekst
+ waar is de button ?
toevoeging op 3 juni 2012, 1112:
geen or die(mysql_error());
De button moet je ff scrollen naar rechts.
[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]verzenden[/COLOR][COLOR= #007700]]))
{[/COLOR]
[COLOR= #0000BB]$sVoornaam[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]djzegt[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE djzegt SET tekst => "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$sVoornaam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]DJ zegt veranderd![/COLOR][COLOR= #007700];
}[/COLOR]
?>
<form action="" method="POST"><br />
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input style="width:200px" placeholder="djzegt" type="text" name="djzegt" size="20" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$get_djzegt[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" />[/COLOR][COLOR= #007700];[/COLOR] ?> <input type="submit" name="verzenden" size="20" value="Update" />
</form> Bjarnootjuh schreef:Hij werkt nu half, geen error meer maar hij past het niet aan. Hij zegt wel dat het is gelukt maar blijft hetzelfde:
[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]verzenden[/COLOR][COLOR= #007700]]))
{[/COLOR]
[COLOR= #0000BB]$sVoornaam[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]djzegt[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE djzegt SET tekst => "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$sVoornaam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]DJ zegt veranderd![/COLOR][COLOR= #007700];
}[/COLOR]
?>
<form action="" method="POST"><br />
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input style="width:200px" placeholder="djzegt" type="text" name="djzegt" size="20" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$get_djzegt[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" />[/COLOR][COLOR= #007700];[/COLOR] ?> <input type="submit" name="verzenden" size="20" value="Update" />
</form> Nielsie schreef:Niet echt, wat gebeurd er dan als ik dat weglaat?substr(value, BeginNummer, EindNummer)
Als je dan als value Hoi hebt
En als beginnummer 0 hebt en eindnummer 1 krijg je als resultaat: H
Snap je?
Robertt schreef:Doe is or die(mysql_error()); er achter bij de query dan zie je de fout.Eerdere citaten tonen
Bjarnootjuh schreef:Hij werkt nu half, geen error meer maar hij past het niet aan. Hij zegt wel dat het is gelukt maar blijft hetzelfde:[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]verzenden[/COLOR][COLOR= #007700]])) {[/COLOR] [COLOR= #0000BB]$sVoornaam[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]djzegt[/COLOR][COLOR= #007700]]);[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE djzegt SET tekst => "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$sVoornaam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]DJ zegt veranderd![/COLOR][COLOR= #007700]; }[/COLOR] ?> <form action="" method="POST"><br /> [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input style="width:200px" placeholder="djzegt" type="text" name="djzegt" size="20" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$get_djzegt[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" />[/COLOR][COLOR= #007700];[/COLOR] ?> <input type="submit" name="verzenden" size="20" value="Update" /> </form>
[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][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/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]verzenden[/COLOR][COLOR= #007700]]))
{[/COLOR]
[COLOR= #0000BB]$updateQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE djzegt SET tekst = "[/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]djzegt[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][COLOR= #0000BB]$updateQuery[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Error: [/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]DJ zegt veranderd![/COLOR][COLOR= #007700];
}
}[/COLOR]
?>
<form action="" method="POST"><br />
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input style="width:200px" placeholder="djzegt" type="text" name="djzegt" size="20" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$get_djzegt[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" />[/COLOR][COLOR= #007700];[/COLOR] ?> <input type="submit" name="verzenden" size="20" value="Update" />
</form> Sebastiaanh schreef:Dit?[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][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/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]verzenden[/COLOR][COLOR= #007700]])) {[/COLOR] [COLOR= #0000BB]$updateQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE djzegt SET tekst = "[/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]djzegt[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][COLOR= #0000BB]$updateQuery[/COLOR][COLOR= #007700]) {[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Error: [/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700](); }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]DJ zegt veranderd![/COLOR][COLOR= #007700]; } }[/COLOR] ?> <form action="" method="POST"><br /> [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input style="width:200px" placeholder="djzegt" type="text" name="djzegt" size="20" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$get_djzegt[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" />[/COLOR][COLOR= #007700];[/COLOR] ?> <input type="submit" name="verzenden" size="20" value="Update" /> </form>

Sanderc schreef:GoogleAls je van een array een random wilt nemen, dan geef je toch eerst die arrays een waarde met foreach? Of hoe moet ik dit anders doen?
http://php.net/manual/en/function.array-rand.phpSanderc schreef:Of je doet iets als dit:Als je van een array een random wilt nemen, dan geef je toch eerst die arrays een waarde met foreach? Of hoe moet ik dit anders doen?
[COLOR= #0000BB]<?php
$array[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]lol[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]mol[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]trol[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$array[/COLOR][COLOR= #007700][[/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$array[/COLOR][COLOR= #007700]) -[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])];[/COLOR]
?>