Hello,
Im quit new to php, and i've a problem. I have a mysql database connection, and a field in the database looks like this:
album id | track | title |
------------------------------------------------------------------------------
mil020601 | 01 | title1 |
mil020601 | 02 | title2 |
mil020601 | 03 | title3 |
ok this is my php-code:
<? require("connect.php"); ?>
<?
// SQL query
$query = "SELECT distinct track FROM `tracks` where album_id='$album_id' order by 'track'";
$result_albums = mysql_query("$query" ,$conn)
or die("Fout bij uitvoeren query");
// get array from database
while($results_array = mysql_fetch_array($result_albums)) {
$track = $results_array['track'];
}
?>
<? //echo ("$track") ?>
<? //echo ($track[1]) ?>
now what i want is to fill an array that looks like this :
index 0 | 1 | 2
------------------------------------------
01 | 02 | 03
i think i've to do something with a for loop, but maybe you now better, can you pleae help me?
thanks in advance,
Arnaud
Im quit new to php, and i've a problem. I have a mysql database connection, and a field in the database looks like this:
album id | track | title |
------------------------------------------------------------------------------
mil020601 | 01 | title1 |
mil020601 | 02 | title2 |
mil020601 | 03 | title3 |
ok this is my php-code:
<? require("connect.php"); ?>
<?
// SQL query
$query = "SELECT distinct track FROM `tracks` where album_id='$album_id' order by 'track'";
$result_albums = mysql_query("$query" ,$conn)
or die("Fout bij uitvoeren query");
// get array from database
while($results_array = mysql_fetch_array($result_albums)) {
$track = $results_array['track'];
}
?>
<? //echo ("$track") ?>
<? //echo ($track[1]) ?>
now what i want is to fill an array that looks like this :
index 0 | 1 | 2
------------------------------------------
01 | 02 | 03
i think i've to do something with a for loop, but maybe you now better, can you pleae help me?
thanks in advance,
Arnaud