Controleren of er wel degelijk op submit gedrukt is. Nu voert hij de query altijd uit en dan is $_POST dus niks. Daarna komt er dus niks in de database en is alles leeg.
Vragen topic van mij
Kun je even zeggen hoe ik het beste dat kan doen?
Ga naar pagina 3.
toevoeging op 18 februari 2012, 12:32:06:
toevoeging op 18 februari 2012, 12:32:06:
Jespar schreef:Error:
Column count doesnt match value count at row 1
[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]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE id = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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]$uFetche[/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 scriptszien VALUES (
NULL,
"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$uFetche[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]",
"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]snaam[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]",
"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sbericht[/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]<div id="succes">Je script staat nu op de site! <a href="index.php">Klik hier</a></div>[/COLOR][COLOR= #007700];
}[/COLOR]
?>
<br />
Vraag via deze pagina een script aan.<br /><br />
<form method="post" action="?p=scriptvragen">
Script naam: <input type="text" name="snaam" /><br />
Scriptbericht:<br /> <textarea name="sbericht" style="width: 500px; height: 150px;"></textarea><br />
<input type="submit" name="submit" value="Verzend" />
</form> [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= #FF8000]/** Ophalen van de nieuwsberichten **/[/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 nieuws ORDER BY id"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$uresult[/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]<a hef="?p=newschange&id=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</a><br />[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]/** Einde van ophalen **/[/COLOR]
[COLOR= #0000BB]$uuQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM nieuws WHERE id = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$uuresult[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uuQuery[/COLOR][COLOR= #007700]);[/COLOR]
?>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE nieuws SET titel="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", aan="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]aan[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", bericht="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/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]
?>
<form method="post" action="?p=newschange&id=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>">
Titel: <input type="text" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uuresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>" name="titel" /><br />
Aan/Uit <input type="text" value="Aan/uit" name="aan" /><br />
Bericht <br /><textarea name="bericht" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uuresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]];[/COLOR] ?>" style="width: 500px; height: 150px;"></textarea><br />
<input type="submit" name="submit" value="Verander" />
</form> Als ik dat heb, haalt hij de gegevens niet uit de database, hij kan het niet ophalen dus.
toevoeging op 18 februari 2012, 12:43:23:
Terwijl er wel wat staat in db
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/** Ophalen van de nieuwsberichten **/[/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 nieuws ORDER BY id"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$uresult[/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]<a hef="?p=newschange&id=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</a><br />[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]/** Einde van ophalen **/[/COLOR]
[COLOR= #0000BB]$uuQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM nieuws WHERE id = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$uuresult[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uuQuery[/COLOR][COLOR= #007700]);[/COLOR]
?>
[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]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE nieuws SET titel="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", aan="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]aan[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", bericht="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/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]
?>
<form method="post" action="?p=newschange&id=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>">
Titel: <input type="text" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uuresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>" name="titel" /><br />
Aan/Uit <input type="text" value="Aan/uit" name="aan" /><br />
Bericht <br /><textarea name="bericht" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uuresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]];[/COLOR] ?>" style="width: 500px; height: 150px;"></textarea><br />
<input type="submit" name="submit" value="Verander" />
</form> Bij bericht showt hij niks?!?!?!?!
Errors
?
?Geen errors, maar bij de textarea showt hij niks 

Bij textarea werk je toch niet met value maar gewoon zo :
Regel 17:
Je miste een r bij uur.
$uuresult = mysql_fetch_assoc($uurQuery); Je miste een r bij uur.
Ohja, dom van me 

Maartenl schreef:En inderdaad klopt dit ook.Bij textarea werk je toch niet met value maar gewoon zo :
Hijwerktal
Ik heb je script een beetje beveiligd en wat netter gemaakt:
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/** Ophalen van de nieuwsberichten **/[/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 nieuws ORDER BY id"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$uresult[/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]<a hef="?p=newschange&id=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</a><br />[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]/** Einde van ophalen **/[/COLOR]
[COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] mysql_real_escape_strings[COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]));[/COLOR]
[COLOR= #0000BB]$uurQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM nieuws WHERE id = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$uuresult[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uurQuery[/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]$titel[/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]titel[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$aan[/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]aan[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$bericht[/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]bericht[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE nieuws SET titel="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$titel[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]", aan="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$aan[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]", bericht="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$bericht[/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]
?>
<form method="post" action="?p=newschange&id=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$id[/COLOR][COLOR= #007700];[/COLOR] ?>">
<table>
<tr>
<td>Titel:</td>
<td><input type="text" name="titel" id="titel" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uuresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>" /></td>
</tr>
<tr>
<td>Aan/Uit:</td>
<td><input type="text" id="aan" name="aan" value="Aan/uit" /></td>
</tr>
<tr>
<td>Bericht:</td>
<td><textarea name="bericht" style="width: 500px; height: 150px;">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uuresult[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]];[/COLOR] ?></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" id="submit" name="submit" value="Verander" /></td>
</tr>
</table>
</form> [COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]==[/COLOR]voorbeeld[COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Goedzo[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Vul een wachtwoord in[/COLOR][COLOR= #007700];
}[/COLOR]
?>
<form method="post" action="index.php">
Wachtwoord<br />
<input type="password" name="password" /><br />
<input type="submit" name="submit" value="Log in" />
</form> Ik weet niet of ik goed bezig ben maar ik wil een licentie systeem in, als je het wachtwoord voorbeeld intypt is ie goed en de rest niet goed. Als hij goed is moet hij een pagina showen