This code repeats the name a bunch of times and i need it to just show one of the names if i make the limmit 1 then it shows just one but not the other posts any help?
<?php
/* Connecting, selecting database */
include ("connect.php");
/* Performing SQL query */
$query = "SELECT gname FROM gbook WHERE user='$user' LIMIT 15";
$result = mysql_query($query) or die("Query failed");
/* Printing results in HTML */
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
print "$col_value\n";
}
print "\t\n";
}
print "\n";
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($link);
?>