I made a code for getting all the values in a field from a database and displayed them on the browser, I use foreach() loop through the array of that field,but the result is just two value were printed. If I didn't state clear enough, please look at here:
Link is http://mili.phpwebhosting.com/~llama/PHPtesting/testarray.php
My code is here:
<html>
<head>
<title>
</title>
</head>
<body>
<?php
$user="llama";
$pass="osti";
$db="funpic";
$Fresult=array(); //for storing the filename field from database
$link=mysql_connect("localhost",$user,$pass);
if(!link)
die("couldn't connect MYSQL");
mysql_select_db($db)
or die("couldn't open $db:".mysql_error());
$filename=mysql_query("SELECT filename FROM PicInfo"); //pass the query result to $filename
$Fresult=mysql_fetch_array($filename); //transfer $filename to array
foreach($Fresult as $val){
print "<A href=\"http://mili.phpwebhosting.com/~llama/PHPtesting/Uploads/$val\">$val</a><br> ";
}
?>
</body>
</html>
Thanks!😃