[help] php marquee
Duwd schreef:1Hallo,
ik ben bezig met een klein scriptje voor een berichten balk.
maar nu wil ik dus dat alle informatie uit de database achter elkaar beweegt maar nu heb ik dit
http://mop.s2.one2xs.com/balk.php
het script
Codeblok (balk.php):
2
3
4
5
6
7
nieuw
echo "$naam - $bericht";
}
?>
weet iemand hoe ik dit moet oplossen?
mvg
Je zou met een while ze achterelkaar kunnen plakken.
[COLOR= #0000BB]<?php
$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]SELECT * FROM berichten ORDER BY date DESC[/COLOR][COLOR= #007700]);[/COLOR]
?>
<marquee>
<a href="#">nieuw</a>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/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]
[URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] - [/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] | [/COLOR][COLOR= #007700];
}[/COLOR]
?>
</marquee> Xjessex schreef:Als ik dat doe komt er helemaal niks?[COLOR= #0000BB]<?php $query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]SELECT * FROM berichten ORDER BY date DESC[/COLOR][COLOR= #007700]);[/COLOR] ?> <marquee> <a href="#">nieuw</a> [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/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] [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] - [/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] | [/COLOR][COLOR= #007700]; }[/COLOR] ?> </marquee>
Duwd schreef:Als ik dat doe komt er helemaal niks?Eerdere citaten tonen
Xjessex schreef:[COLOR= #0000BB]<?php $query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]SELECT * FROM berichten ORDER BY date DESC[/COLOR][COLOR= #007700]);[/COLOR] ?> <marquee> <a href="#">nieuw</a> [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/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] [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] - [/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] | [/COLOR][COLOR= #007700]; }[/COLOR] ?> </marquee>
Wel even de goede query hé.
Xjessex schreef:mysqli[COLOR= #0000BB]<?php $query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]SELECT * FROM berichten ORDER BY date DESC[/COLOR][COLOR= #007700]);[/COLOR] ?> <marquee> <a href="#">nieuw</a> [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/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] [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] - [/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] | [/COLOR][COLOR= #007700]; }[/COLOR] ?> </marquee>


Dylanh schreef:mysqliEerdere citaten tonen
Xjessex schreef:[COLOR= #0000BB]<?php $query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]SELECT * FROM berichten ORDER BY date DESC[/COLOR][COLOR= #007700]);[/COLOR] ?> <marquee> <a href="#">nieuw</a> [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/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] [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] - [/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] | [/COLOR][COLOR= #007700]; }[/COLOR] ?> </marquee>


Doe ik niet aan.
Ik programmeer sowieso niet meer in PHP

Spoiler tonen
Codeblok (balk.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = mysql_query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = mysql_fetch_assoc($query) {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>
dit is wat ik nu heb maar ik krijg niks
Duwd schreef:1Spoiler tonen
Codeblok (voorbeeld.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = mysql_query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = mysql_fetch_assoc($query) {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>
dit is wat ik nu heb maar ik krijg niks
Bestaat de tabel laatste?
Robiin schreef:1Eerdere citaten tonen
Duwd schreef:Spoiler tonen
Codeblok (voorbeeld.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = mysql_query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = mysql_fetch_assoc($query) {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>
dit is wat ik nu heb maar ik krijg niks
Bestaat de tabel laatste?
jup
Duwd schreef:dit is wat ik nu heb maar ik krijg niks1Eerdere citaten tonen
Robiin schreef:Eerdere citaten tonen
Duwd schreef:Spoiler tonen
Codeblok (voorbeeld.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = mysql_query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = mysql_fetch_assoc($query) {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>
Bestaat de tabel laatste?
jup
Hoe zit de structuur in elkaar?
Robiin schreef:Bestaat de tabel laatste?dit is wat ik nu heb maar ik krijg niksEerdere citaten tonen
Duwd schreef:1Eerdere citaten tonen
Robiin schreef:Eerdere citaten tonen
Duwd schreef:Spoiler tonen
Codeblok (voorbeeld.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = mysql_query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = mysql_fetch_assoc($query) {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>
jup
Hoe zit de structuur in elkaar?
Afbeelding niet beschikbaarDe bron kon niet worden geladen (i61.tinypic.com).Bron openen ↗Duwd schreef:jupBestaat de tabel laatste?Eerdere citaten tonen
Robiin schreef:dit is wat ik nu heb maar ik krijg niksEerdere citaten tonen
Duwd schreef:1Eerdere citaten tonen
Robiin schreef:Eerdere citaten tonen
Duwd schreef:Spoiler tonen
Codeblok (voorbeeld.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = mysql_query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = mysql_fetch_assoc($query) {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>
Hoe zit de structuur in elkaar?
Afbeelding
Wat krijg je te zien?
Duwd schreef:1Spoiler tonen
Codeblok (balk.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = mysql_query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = mysql_fetch_assoc($query) {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>
dit is wat ik nu heb maar ik krijg niks
Je gebruikt MySQL en MySQLi door elkaar.
Doe dus óf je verbinding in MySQL of je querys in MySQLi
Bugged schreef:1Eerdere citaten tonen
Duwd schreef:Spoiler tonen
Codeblok (balk.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = mysql_query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = mysql_fetch_assoc($query) {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>
dit is wat ik nu heb maar ik krijg niks
Je gebruikt MySQL en MySQLi door elkaar.
Doe dus óf je verbinding in MySQL of je querys in MySQLi
Ochja, dat ik dat nou niet zag

toevoeging op 13 april 2014, 15:02:22:
Codeblok (voorbeeld.php):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$con=mysqli_connect("localhost","***","***","***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
$query = $con->query("SELECT * FROM laatste ORDER BY id ASC");
?>
nieuw
while($message = $query->fetch_assoc() {
echo htmlentities($message[naam]). - .htmlentities($message[bericht]). | ;
}
?>