-2
<? 
$DBAlanadi = "SELECT * FROM Alanadi";
$ACAlanadi = mysql_query($DBAlanadi);
$TotalAlanadi = mysql_num_rows($ACAlanadi);
$Alanadi = mysql_fetch_object($ACAlanadi);

if($TotalAlanadi!=0): 
     while( $Fiyat=$Alanadi ): 
         echo '<a>'.$Fiyat->fiyat.'</a>'; 
     endwhile; 
 endif;
 mysqli_free_result($Alanadi); ?>

line 1 is only endlessly turning

but

I want 40 TL 35 TL 50 TL

Pradeep
  • 9,667
  • 13
  • 27
  • 34

1 Answers1

0

You need to call mysql_fetch_object() each time through the loop. Otherwise you're just processing the first row over and over.

<? 
$DBAlanadi = "SELECT * FROM Alanadi";
$ACAlanadi = mysql_query($DBAlanadi);
$TotalAlanadi = mysql_num_rows($ACAlanadi);

if($TotalAlanadi!=0): 
     while( $Fiyat= mysql_fetch_object($ACAlanadi) ): 
         echo '<a>'.$Fiyat->fiyat.'</a>'; 
     endwhile; 
 endif;
 mysql_free_result($Alanadi); 
?>

BTW, the mysql extension has been deprecated for many years, and has been totally removed from the current version of PHP. You should convert to mysqli or PDO as soon as possible.

And you can't call mysqli_free_result when the result is from mysql, you have to use mysql_free_result.

See Can I mix MySQL APIs in PHP?

Pradeep
  • 9,667
  • 13
  • 27
  • 34
Barmar
  • 741,623
  • 53
  • 500
  • 612