Berichtebalk mysql verbinding

Gestart doorWouterr4 reacties30 weergaven

5 berichten · pagina 1 van 1

Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Hallo iedereen,

ik heb hier een code, Alle scheld woorden staan in de tabel (Scheldwoorden) Met 2 velden "id""Scheldwoorden"

Database:

-- phpMyAdmin SQL Dump
-- version 3.2.5
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 07 Apr 2010 om 19:46
-- Serverversie: 5.0.67
-- PHP-Versie: 5.2.12

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `jkoemans_balk`
--

-- --------------------------------------------------------

--
-- Tabelstructuur voor tabel `scheldwoorden`
--

CREATE TABLE IF NOT EXISTS `scheldwoorden` (
  `id` int(3) NOT NULL auto_increment,
  `scheldwoorden` varchar(25) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Gegevens worden uitgevoerd voor tabel `scheldwoorden`
--

INSERT INTO `scheldwoorden` (`id`, `scheldwoorden`) VALUES
(1, kk);
(2, KK);


Script:

[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/echo"]echo[/URL] [COLOR= #DD0000]"&nbsp;<a href="site.php?p=toevoegen">Bericht plaatsen</a>&nbsp;&nbsp;&nbsp;"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<marquee width=88% style="cursor: default" onmouseover="this.stop()" onmouseout="this.start()">"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$censuur1[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `scheldwoorden`"[/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]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM berichtenbalk ORDER BY id DESC LIMIT "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$hoeveel[/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/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$obj[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_object"]mysql_fetch_object[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])) {[/COLOR]
   [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$obj[/COLOR][COLOR= #007700]->[/COLOR]naam[COLOR= #007700]);[/COLOR]
   [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$obj[/COLOR][COLOR= #007700]->[/COLOR]bericht[COLOR= #007700]);[/COLOR]
   [COLOR= #0000BB]$censuur[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$censuur1[/COLOR][COLOR= #007700]);[/COLOR]
   [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$censuur[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]bobba[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
   [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$censuur[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]Bobba[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700]);[/COLOR]

   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"</b>: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$teken[/COLOR][COLOR= #007700];
}[/COLOR]

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


Maar hij zou dus dan bij $censuur = array($censuur1); alle scheldwoorden uit de database ophalen en dan op de plaats waar $censuur1 (ook hier: $censuur = array($censuur1)wink zou die dus dan alle scheld woorden zo moeten neer zetten: $censuur = array(kk, KK); maar dat werkt niet?

alvst bedankt!
streaming
0
Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Niemand sadley
0
Berichten
1.641
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
je mag alleen om de 24 uur bumpen...
0
Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

wat is bumpen?
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/COLOR]
?>
&nbsp;<a href="site.php?p=toevoegen">Bericht plaatsen</a>&nbsp;&nbsp;&nbsp;
<marquee width=88% style="cursor: default" onmouseover="this.stop()" onmouseout="this.start()">
[COLOR= #0000BB]<?php
    
    $censuur_query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
    SELECT
        *
    FROM
        scheldwoorden
    "[/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]$scheldwoorden[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$censuur_query[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$scheldwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$censuur_query[/COLOR][COLOR= #007700]))
        {[/COLOR]
            
            [COLOR= #0000BB]$scheldwoorden[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #0000BB]$scheldwoord[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]scheldwoorden[/COLOR][COLOR= #007700]];
            
        }
        
    }[/COLOR]
    
    [COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
    SELECT
        *
    FROM
        berichtenbalk
    ORDER BY
        id DESC
    LIMIT
        "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$hoeveel[/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/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/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]$naam[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]);[/COLOR]
        [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]);[/COLOR]
        
        [URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$scheldwoorden[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$woord[/COLOR][COLOR= #007700])
        {[/COLOR]
            
            [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$woord[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]bobba[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
            [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$woord[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]Bobba[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700]);
            
        }[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"</b>: "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$teken[/COLOR][COLOR= #007700];
        
    }[/COLOR]
    
?>
</marquee>


Niet super efficiënt maarja emo
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