Woorden beginnend met 0 t/m 9 selecteren
SELECT artiest, titel, id FROM `media` WHERE artiest LIKE 0% ORDER BY artiest ASC
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?
#Mysql connectie
mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die(mysql_error());
#Tabel selecteren
mysql_select_db($mysql_db);
if ($_GET['functie'] == 'schrijven' && $_SERVER['REQUEST_METHOD'] == 'POST'){
$b = range(0, 9);
$q = "SELECT artiest, titel, id FROM media WHERE ";
$c = count($b) - 1;
for ($i=0;$i<$c;$i++) {
$q .= "artiest LIKE '{$i}% ' ";
if ($i != $c) {
$q .= "OR ";
}
}
$q .= "ORDER BY artiest ASC";
}else{
$b = range(0, 9);
$q = "SELECT artiest, titel, id FROM media WHERE ";
$c = count($b) - 1;
for ($i=0;$i<$c;$i++) {
$q .= "artiest LIKE '{$i}% ' ";
if ($i != $c) {
$q .= "OR ";
}
}
$q .= "ORDER BY artiest ASC";
}
#shouts selecteren
$query = @mysql_query($lijst_sql) or die(mysql_error());
if(mysql_num_rows($query)==0)
{
// er zijn geen gegevens
echo'<strong>(Nog) Geen clips aanwezig</strong>';
}
else
{
while($record = mysql_fetch_assoc($query)){
// en de rest van de while
echo'<a href="javascript:popUp(\'/media/video.php?id='.$record['id'].'\')" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\''.$record['id'].'w\',\'\',\'../images/cam2.gif\',1)"><img src="../images/cam.gif" name="'.$record['id'].'w" width="12" height="8" border="0" id="'.$record['id'].'w" /> '.$record['artiest'].' - '.$record['titel'].'</a><br>';
}
}
?>
#Mysql connectie
mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die(mysql_error());
#Tabel selecteren
mysql_select_db($mysql_db);
if ($_GET['functie'] == 'schrijven' && $_SERVER['REQUEST_METHOD'] == 'POST'){
$b = range(0, 9);
$q = "SELECT artiest, titel, id FROM media WHERE ";
$c = count($b) - 1;
for ($i=0;$i<$c;$i++) {
$q .= "artiest LIKE '{$i}% ' ";
if ($i != $c) {
$q .= "OR ";
}
}
$q .= "ORDER BY artiest ASC";
}else{
$b = range(0, 9);
$q = "SELECT artiest, titel, id FROM media WHERE ";
$c = count($b) - 1;
for ($i=0;$i<$c;$i++) {
$q .= "artiest LIKE '{$i}% ' ";
if ($i != $c) {
$q .= "OR ";
}
}
$q .= "ORDER BY artiest ASC";
}
#shouts selecteren
$query = @mysql_query($lijst_sql) or die(mysql_error());
if(mysql_num_rows($query)==0)
{
// er zijn geen gegevens
echo'<strong>(Nog) Geen clips aanwezig</strong>';
}
else
{
while($record = mysql_fetch_assoc($query)){
// en de rest van de while
echo'<a href="javascript:popUp(\'/media/video.php?id='.$record['id'].'\')" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\''.$record['id'].'w\',\'\',\'../images/cam2.gif\',1)"><img src="../images/cam.gif" name="'.$record['id'].'w" width="12" height="8" border="0" id="'.$record['id'].'w" /> '.$record['artiest'].' - '.$record['titel'].'</a><br>';
}
}
?>
Ja dat was waar ook, had ook gekunt :-)
Net lokaal uitgetest en werkt prima. Bovendien super kort :-)