hi
im trying to read the ids from a table into a array so that i know which ids are in the table. i use the following code but it doesn't work. anybody know why ? thx.
<?
$counter = mysql_query("SELECT Count(*) as total FROM links");
$anzahl = mysql_fetch_array($counter);
$anzahl2 = $anzahl[total];
if ($anzahl > 5) $anzahl = 5;
echo"$anzahl out of ";
echo $anzahl2;
?>
</div>
<br>
<?
$sqlbefehl = "select id from links";
$getids = mysql_query($sqlbefehl,$serverid);
$ids = mysql_fetch_array($getids));
$zeit=time();
mt_srand($zeit);
while ($a < $anzahl)
{
$zahl = abs(mt_rand(0,($anzahl-1)));
$id = $ids[$zahl];
$sqlbefehl = mysql_query("select * from links where id='$id'");
$links = mysql_fetch_array($sqlbefehl);
echo". : : ";
echo $ids[2]; // i added this line only to see if the array has something in it
echo"<a href=\"$links[link]\" target=\"_blank\">$links[name]</a><br>";
$a++;
}
?>
here the dumb from the table:
id int(14) NOT NULL auto_increment,
cat varchar(255) NOT NULL,
link varchar(255) NOT NULL,
name varchar(255) NOT NULL,
PRIMARY KEY (id)