Database records in array
jimmy Arts
01/02/2009 22:55:00PHP hulp
18/12/2024 07:52:37Jelmer -
01/02/2009 23:16:00jimmy Arts
01/02/2009 23:18:00Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
include "config.php";
$prikbord_select_query = mysql_query("SELECT * FROM prikbord ORDER BY id DESC LIMIT 25");
while($prikbord_result = mysql_fetch_array($prikbord_select_query)){
$a = array($prikbord_result['naam']);
}
$i = 0;
foreach ($a as $v) {
echo "$i = $v\n";
$i++;
}
?>
include "config.php";
$prikbord_select_query = mysql_query("SELECT * FROM prikbord ORDER BY id DESC LIMIT 25");
while($prikbord_result = mysql_fetch_array($prikbord_select_query)){
$a = array($prikbord_result['naam']);
}
$i = 0;
foreach ($a as $v) {
echo "$i = $v\n";
$i++;
}
?>
ik weet hoe mysql werkt maar ik denk dat ik op het moment nogal in de war bent iemand een id hoe ik dit werkend krijg?
Gewijzigd op 01/01/1970 01:00:00 door jimmy Arts
Jelmer -
01/02/2009 23:27:00Je vervangt de inhoud van $a steeds in de while-lus. Waarschijnlijk bedoelde je dit:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
include "config.php";
$prikbord_select_query = mysql_query("SELECT * FROM prikbord ORDER BY id DESC LIMIT 25");
$a = array();
while($prikbord_result = mysql_fetch_array($prikbord_select_query)){
$a[] = $prikbord_result['naam'];
}
$i = 0;
foreach ($a as $v) {
echo "$i = $v\n";
$i++;
}
?>
include "config.php";
$prikbord_select_query = mysql_query("SELECT * FROM prikbord ORDER BY id DESC LIMIT 25");
$a = array();
while($prikbord_result = mysql_fetch_array($prikbord_select_query)){
$a[] = $prikbord_result['naam'];
}
$i = 0;
foreach ($a as $v) {
echo "$i = $v\n";
$i++;
}
?>