Berichtenbalk

Gestart doorShahiem17 reacties29 weergaven

18 berichten · pagina 1 van 2

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een berichtenbalk maar hij geeft alleen mijn naam.
Hoe los ik dat op.

[COLOR= #0000BB]<?php
            $querys[/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 0,8"[/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/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$querys[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]        
            <div class="plaats"><a href="?p=berichtenbalk_plaats"><img src="img/plaats.png" 

align="left" /></a></div><div class="balkbericht">
                
                        <marquee width="100%" onmouseover="this.stop()" 

loop="-1" onmouseout="this.start()">[/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]$querys[/COLOR][COLOR= #007700])) {[/COLOR]
                        [COLOR= #0000BB]$sql3[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT uName FROM member_accounts 

WHERE uId = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]]);[/COLOR]
                        
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row3[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql3[/COLOR][COLOR= #007700])){[/COLOR]
                        
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]            

~ <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$link[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]/profiel?id=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row3[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"><b>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row3[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uName[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</b></a> - 

[/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]);
}
                    }[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]
                </marquee></div>[/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]
                De berichtbalk is leeg.[/COLOR][COLOR= #007700];
                }[/COLOR]
                ?>
0
Tom

Lid

Berichten
3.868
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
Een nieuwe downloaden en die gebruiken?
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je checkt ook op het sessie id van de ingelogde gebruiker, ipv. de plaatser van het bericht.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kun je een dump maken van de tabel berichtenbalk?
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
-- phpMyAdmin SQL Dump
-- version 3.2.3
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 30 Nov 2009 om 19:04
-- Serverversie: 5.1.40
-- PHP-Versie: 5.2.11

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `shahiem_hr`
--

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

--
-- Tabelstructuur voor tabel `berichtenbalk`
--

CREATE TABLE IF NOT EXISTS `berichtenbalk` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `bericht` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

--
-- Gegevens worden uitgevoerd voor tabel `berichtenbalk`
--
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
waar is de naam die opgeslagen moet worden biggrinhij pakt de naam van het ingelogde lid die zet hij dan neer
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je moet een veld userid toevoegen en dan de query waar de username wordt opgehaald aanpassen zodat ie de username ophaalt die bij de userid hoort?
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dus een userveld bij Berichtenbalk maar die laatste ding snap k niet ;(
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
je hebt bijvoorbeeld bij member_news de row "nAuth" of iets dergelijks. Daarin staat het id van de persoon die het bericht heeft gepost.
Die kun je dan ophalen, en dan via member_accounts bekijken wat de naam, kleur, en dergelijk is.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
                $querys[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT b.bericht, b.userid, m.uName FROM berichtenbalk AS b, member_accounts AS m WHERE m.uId = b.userid ORDER BY b.id DESC LIMIT 0,8"[/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]
?>       
            <div class="plaats">
                <a href="?p=berichtenbalk_plaats"><img src="img/plaats.png" align="left" /></a>
            </div>
            <div class="balkbericht">
                <marquee width="100%" onmouseover="this.stop()" loop="-1" onmouseout="this.start()">
[COLOR= #0000BB]<?php[/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]$querys[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/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]$querys[/COLOR][COLOR= #007700]))
                    {[/COLOR]
?>
                    ~ <a href="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$link[/COLOR][COLOR= #007700];[/COLOR] ?>/profiel?id=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]userid[/COLOR][COLOR= #007700]];[/COLOR] ?>"><b>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uName[/COLOR][COLOR= #007700]]);[/COLOR] ?></b></a> - [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]);[/COLOR] ?> 
[COLOR= #0000BB]<?php[/COLOR]
                    [COLOR= #007700]}
                }[/COLOR]
                [URL="http://www.php.net/else"]else[/URL]
                [COLOR= #007700]{[/COLOR]
?>
                    De berichtenbalk is leeg.
[COLOR= #0000BB]<?php[/COLOR]
                [COLOR= #007700]}[/COLOR]
?>
                </marquee>
            </div>
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
De code doet het wel , maar nu geeft hij aan dat de berichtenbalk leeg is terwijl er wel delijk berichten zijn.
0
Tom

Lid

Berichten
3.868
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
Dan vergeet je de berichten op te halen uit de database.
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Tom schreef:
Dan vergeet je de berichten op te halen uit de database.
Kan je geen PHP ofzo? Bekijk de code eerst.
Voordat je iets post.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Tom schreef:
Dan vergeet je de berichten op te halen uit de database.
Nee, er klopt iets niet in de query.

@shahiem: heb je het veld userid al toegevoegd?
Zo ja, staat er overal 0, dan veranderen in andere cijfers en het zou moeten werken
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hij doet jet smile BEDANKT LUUKsmile
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