Dubbel check fout

Gestart doorNathan6 reacties18 weergaven

7 berichten · pagina 1 van 1

Nathan

Lid · Topicstarter

Berichten
4.936
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
//Problemen zijn opgelost bedankt!
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$res = mysql_query("SELECT * FROM coupons WHERE code = $serial");

moet

$res = mysql_query("SELECT * FROM coupons WHERE code = $serial");

zijn
0
Nathan

Lid · Topicstarter

Berichten
4.936
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Error is nu verholpen ja, maar hij checkt hem niet..sadley
Ik zie die kleine fouten maar niet zoals hier;

mysql_query("UPDATE coupons SET code=$code, author=$waarde WHERE id = $id");


Wat is hier mis mee?
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]])[/COLOR] OR [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]Voeg de code hier in[/COLOR][COLOR= #007700])
                        {[/COLOR]
                            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen code ingevuld. <a href="javascript:history.go(-1)"><b>ga terug</b> "[/COLOR][COLOR= #007700];
                        }[/COLOR]
                        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]waarde[/COLOR][COLOR= #007700]])[/COLOR] OR [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]waarde[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]Waarde van de coupon[/COLOR][COLOR= #007700])
                        {[/COLOR]
                            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen waarde ingevuld."[/COLOR][COLOR= #007700];
                        }[/COLOR]
                        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]expire[/COLOR][COLOR= #007700]])[/COLOR] OR [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]expire[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]Geldig tot[/COLOR][COLOR= #007700]){[/COLOR]
                            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen verloop datum ingevuld.<a href="javascript:history.go(-1)"><b>ga terug</b> "[/COLOR][COLOR= #007700];
                        }[/COLOR]
                        [URL="http://www.php.net/else"]else[/URL]
                        [COLOR= #007700]{[/COLOR]
                            [COLOR= #0000BB]$lengte[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]]);[/COLOR]
                            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$lengte[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]16[/COLOR][COLOR= #007700])
                            {[/COLOR]
                                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De code die u heeft ingevoerd is te kort. <a href="javascript:history.go(-1)"><b>ga terug</b>"[/COLOR][COLOR= #007700];
                            }[/COLOR] 
                            [URL="http://www.php.net/else"]else[/URL]
                            [COLOR= #007700]{[/COLOR]
                                                        [COLOR= #0000BB]$serial[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]];[/COLOR]
                                                        [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM coupons WHERE code = $serial"[/COLOR][COLOR= #007700]);[/COLOR]
                                                        [COLOR= #0000BB]$rows[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700]);[/COLOR]

                                                        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
                                                        {[/COLOR]
                            [COLOR= #0000BB]$code[/COLOR]    [COLOR= #007700]=[/COLOR] htmlentities[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]code[/COLOR][COLOR= #007700]]));[/COLOR]
                            [COLOR= #0000BB]$waarde[/COLOR]  [COLOR= #007700]=[/COLOR] htmlentities[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]waarde[/COLOR][COLOR= #007700]]));[/COLOR]
                            [COLOR= #0000BB]$expire[/COLOR]  [COLOR= #007700]=[/COLOR] htmlentities[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]expire[/COLOR][COLOR= #007700]]));[/COLOR]
                            [COLOR= #0000BB]$adddate[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"H:i:s d.m.Y"[/COLOR][COLOR= #007700]);[/COLOR]
                            [COLOR= #0000BB]$ip[/COLOR]      [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]];[/COLOR]
                            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO coupons(code, author, date, adddate, ip) VALUES ($code, $waarde, $expire, $adddate, $ip)"[/COLOR][COLOR= #007700]);[/COLOR]
                            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De code is succesvol aan de database toegevoegd. <a href="javascript:history.go(-1)"><b>ga terug</b> "[/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]"Deze code is helaas als eens toegevoegd."[/COLOR][COLOR= #007700];
                                                        }
                        }
                        }[/COLOR]
?>


Edit; Zet achter je querys overal eens or die(mysql_error());
0
Nathan

Lid · Topicstarter

Berichten
4.936
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nathan is php noob hoor...emo
[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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]go[/COLOR][COLOR= #007700]])) :[/COLOR]
                ?>
                    <form method="post" action="">
                        <input type="text" value="Code" name="code" onFocus="this.value=" /><input type="text" value="Waarde van coupon" name="waarde" onFocus="this.value=" /><br />
                        <input type="submit" value="Pas aan" name="go" />
                    </form>
                [COLOR= #0000BB]<?php[/COLOR]
                [URL="http://www.php.net/else"]else[/URL] [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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]])) :[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Er is geen code ingevuld."[/COLOR][COLOR= #007700];[/COLOR]
                    [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]waarde[/COLOR][COLOR= #007700]])) :[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Er is geen waarde ingevuld."[/COLOR][COLOR= #007700];[/COLOR]
                    [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]:[/COLOR]
                        [COLOR= #0000BB]$code[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]];[/COLOR]
                        [COLOR= #0000BB]$waarde[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]waarde[/COLOR][COLOR= #007700]];[/COLOR]
                        [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
                        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE coupons SET code=$code, author=$waarde WHERE id = $id"[/COLOR][COLOR= #007700]);
                    endif;
                endif;[/COLOR]
                ?>


Waarom wilt ie in de admin niet editen?
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Vul is bij action="" je pagina titel + exentie.
0
Nathan

Lid · Topicstarter

Berichten
4.936
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je bedoelt:
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