Ik kan fout in script niet vinden :s

Gestart doorSemmiiee5 reacties15 weergaven

6 berichten · pagina 1 van 1

Semmiiee

Lid · Topicstarter

Berichten
4.013
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey,
Ik heb een gastenboek script gescript.
Ik wou kijken als hij werkte, alles werkt perfect.

Behalve als je alles in vult, en dan op "Plaats!" drukt. Komt er error te staan: "Vul a.u.b alle velden in".

Terwijl alles was ingevuld. Ik kan de fout niet in het script vinden! Help me!

SCRIPT:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// PHP Gastenboek[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<h1>Gastenboek</h1>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<hr>"[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]])
{[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$message[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]message[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$date[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Y-m-d"[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$time[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"H:i:s"[/COLOR][COLOR= #007700]);[/COLOR]
    
    
    
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700])
    {[/COLOR]
        
    [COLOR= #0000BB]$querypost[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSTERT INTO guestbook VALUES (,$name,$email,$message,$date,$time)"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Wacht even... <meta http-equiv=refresh content=2>"[/COLOR][COLOR= #007700];
    
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Vul a.u.b alle velden in."[/COLOR][COLOR= #007700];
}[/COLOR]

[COLOR= #0000BB]$connect[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"localhost"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"IETS//"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"IETS//"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"Verbinden met DATABASE mislukt."[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"IETSS//"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Error in database."[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$queryget[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM guestbook ORDER BY id ASC"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Error met query."[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$querygetrownum[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$queryget[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$querygetrownum[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700])[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br>Er is nog niks in dit gastenboek geplaatst. Wees de eerste!"[/COLOR][COLOR= #007700];[/COLOR]
    
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$queryget[/COLOR][COLOR= #007700]))
{[/COLOR]
 [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
 [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
 [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
 [COLOR= #0000BB]$message[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]message[/COLOR][COLOR= #007700]];[/COLOR]
 [COLOR= #0000BB]$date[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]date[/COLOR][COLOR= #007700]];[/COLOR]
 [COLOR= #0000BB]$time[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]time[/COLOR][COLOR= #007700]];[/COLOR]
 
 [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700]%[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700])[/COLOR]
    [COLOR= #0000BB]$bgcolor[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"#FFFFFF"[/COLOR][COLOR= #007700];[/COLOR]
 [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #0000BB]$bgcolor[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"#e1e1e1"[/COLOR][COLOR= #007700];[/COLOR]
 
 [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"
 
 <table bgcolor=$bgcolor>
        <tr>
            <td>
            <b>Gepost door $name ($email) op $date om $time</b>
            </td>
        </tr>
        <tr>
            <td>
            "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700])).[/COLOR][COLOR= #DD0000]"
            </td>
        </tr>
 </table>
 
 "[/COLOR][COLOR= #007700];
 
}[/COLOR]


[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<hr>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"
<form action=index.php method=POST>
<table width=100%>
    <tr>
        <td width=18%>
        Naam:
        </td>
        <td>
        <input type=text name=name maxlength=25>
        </td>
    </tr>
    <tr>
        <td>
        Email:
        </td>
        <td>
        <input type=text name=Email maxlength=35>
        </td>
        <tr>
        <td valign=top>
        Bericht:
        </td>
        <td>
        <textarea cols=20 rows=2 name=message maxlength></textarea>
        <p>
        <input type=submit name=submit value=Plaats!>
        </td>
    </tr>
    </tr>

</table>
</form>

"[/COLOR][COLOR= #007700];[/COLOR]

?>


- Semmiiee
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
if (isset($name || $email || $message))

?
0
Semmiiee

Lid · Topicstarter

Berichten
4.013
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan krijg ik een hele mooie error:
Parse error: syntax error, unexpected T_IF in /home/semmiiee/domains/getclickmoney.nl/public_html/gastenboek/index.php on line 19

(in het script zelf staat erboven ook:

<html>
<body>
<font face="verdana">
0
Berichten
6.722
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Verander regel 19 door dit:

$querypost = mysql_query("INSTERT INTO guestbook VALUES (,".$name.",".$email.",".$message.",".$date.",".$time.")");
0
Semmiiee

Lid · Topicstarter

Berichten
4.013
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wiitse schreef:
Verander regel 19 door dit:

$querypost = mysql_query("INSTERT INTO guestbook VALUES (,".$name.",".$email.",".$message.",".$date.",".$time.")");
Het blijft nog hetzelfde..

Misschien handig: (live voorbeeld):
http://www.getclickmoney.nl/gastenboek/index.php
0
Berichten
1.115
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja idd, Verwijder je database gegevens door een tip vanmijemo
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