Staff chat

Gestart doorJesper18 reacties61 weergaven

19 berichten · pagina 1 van 2

Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik krijg geen errors maar, ik zie alleen de naam. en het bericht zie ik niet.
http://www.techhabbo.nl/site/?p=admin_chat
Spoiler tonen
$sql = mysql_query("SELECT * FROM staff_chat");
while($row = mysql_fetch_assoc($sql))
echo $row[door];
echo $row[bericht];
?>
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Heet de rij in de database ook bericht ?
Is die leeg of staat er wat in?!
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ja er staat wat in!
Spoiler tonen
Afbeelding
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb het al, alleen ik laat hem nog open, want er kunnen nog fouten ontstaan!
0
Berichten
435
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Beetje raar, waarom je het zo schrijf; Het kan beter zo:

[COLOR= #0000BB]<?
$Query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `staff_chat` ORDER BY id DESC LIMIT 10"[/COLOR][COLOR= #007700]);[/COLOR]
 [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$headinfo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Query[/COLOR][COLOR= #007700]))
{[/COLOR]
[COLOR= #0000BB]$door[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$headinfo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]door[/COLOR][COLOR= #007700]],[/COLOR] ENT_QUOTES[COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$bericht[/COLOR]   [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$headinfo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]],[/COLOR] ENT_QUOTES[COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/print"]print[/URL][COLOR= #DD0000] [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$headinfo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]door[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] - [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$headinfo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik wil nu dat je bericht er in kan toevoegen, stanieboys code heb ik nu.
0
Fass

Lid

Berichten
3.771
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Stanieboy schreef:
Beetje raar, waarom je het zo schrijf; Het kan beter zo:

[COLOR= #0000BB]<?
$Query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `staff_chat` ORDER BY id DESC LIMIT 10"[/COLOR][COLOR= #007700]);[/COLOR]
 [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$headinfo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Query[/COLOR][COLOR= #007700]))
{[/COLOR]
[COLOR= #0000BB]$door[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$headinfo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]door[/COLOR][COLOR= #007700]],[/COLOR] ENT_QUOTES[COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$bericht[/COLOR]   [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$headinfo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]],[/COLOR] ENT_QUOTES[COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/print"]print[/URL][COLOR= #DD0000] [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$headinfo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]door[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] - [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$headinfo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Huh, je maakt eerst de variabelen door en bericht, maar doet er verder niets mee? En waarom output je een spatie..? puh2
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maffiaklik schreef:
ik wil nu dat je bericht er in kan toevoegen, stanieboys code heb ik nu.
Lees dit ff wink
0
Berichten
435
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oke, ik maak wel even iets wink.
Moet dat onder de chat komen te staan?
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
jaaah
0
Berichten
435
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oke. Ik maak wel even wink
0
Berichten
435
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Probeer dit eens, je moet wel even aanpassen voor het uitvoeren van de Qeury:

[COLOR= #0000BB]<?[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]])
{[/COLOR]

[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO staff_chat SET id = , door = HIER DE SESION OFZO, MAAR HIER MOET DE NAAM VAN EEN STAFF LID KOMEN, bericht = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]staff_bericht[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]""[/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= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]

    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700])
    {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Bericht toegevoegd"[/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]"Bericht niet toegevoegd"[/COLOR][COLOR= #007700];
    }
}[/COLOR]  
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]] ||[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]staff_bericht[/COLOR][COLOR= #007700]])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Niet alle velden ingevult!"[/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]"<center>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<table border="0" cellspacing="0" cellpadding="5" align="center">"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<form method="POST" action=""[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$PHP_SELF[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"">"[/COLOR][COLOR= #007700];[/COLOR]

  
   
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr><td>Bericht:</td></tr>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr><td><input type="text" name="staff_bericht"></td></tr>"[/COLOR][COLOR= #007700];[/COLOR]

 

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr><td> </td></tr>"[/COLOR][COLOR= #007700];[/COLOR]

    
  

    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr><td><input type="submit" name="submit" value="Plaats!" class="buttons">&nbsp<input type="reset" value="Wis" class="buttons"></td></tr>"[/COLOR][COLOR= #007700];[/COLOR]
    
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</form>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</table>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</center>"[/COLOR][COLOR= #007700];
}[/COLOR]

?>
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
oke w8 ff
dit krijg ik: Niet alle velden ingevult!
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sorry voor dubbelpost
0
Berichten
435
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zo, nu moet het werken

[COLOR= #0000BB]<?[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]staff_bericht[/COLOR][COLOR= #007700]])
{[/COLOR]

[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO staff_chat SET id = , door = HIER DE SESION OFZO, MAAR HIER MOET DE NAAM VAN EEN STAFF LID KOMEN, bericht = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]staff_bericht[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]""[/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= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]

    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700])
    {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Bericht toegevoegd"[/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]"Bericht niet toegevoegd"[/COLOR][COLOR= #007700];
    }
}[/COLOR]  
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]] ||[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]staff_bericht[/COLOR][COLOR= #007700]])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Niet alle velden ingevult!"[/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]"<center>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<table border="0" cellspacing="0" cellpadding="5" align="center">"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<form method="POST" action=""[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$PHP_SELF[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"">"[/COLOR][COLOR= #007700];[/COLOR]

  
  
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr><td>Bericht:</td></tr>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr><td><input type="text" name="staff_bericht"></td></tr>"[/COLOR][COLOR= #007700];[/COLOR]

 

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr><td> </td></tr>"[/COLOR][COLOR= #007700];[/COLOR]

    
  

    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr><td><input type="submit" name="submit" value="Plaats!" class="buttons">&nbsp<input type="reset" value="Wis" class="buttons"></td></tr>"[/COLOR][COLOR= #007700];[/COLOR]
    
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</form>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</table>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</center>"[/COLOR][COLOR= #007700];
}[/COLOR]

?>
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