I am new to using php and mysql and am really enjoying the experience so far. I want to use an if statement where if the user fills in a field called gamertag and if it is less than 6 char, then it will display "No Gamertag Available" otherwise it will be a link to their gamertag.
LINK TO MY PAGE

<html>
<head>
<link href="../css/website.css" rel="stylesheet" type="text/css">
</head
<body class="site_default">
</body>
</html>


<?php

include('../functions.php');
connect();

function chooseGamertag () {
$sql = "select * from members";
$result = mysql_query($sql) or die("Error: " . $sql);
echo "<form name='gettag' action='$PHP_SELF' method='post'>";
echo "<center><table border='1'>";
echo "<tr><td><b>Username</b></td><td><b>Gamertag</b></td></tr>";

while ($row=mysql_fetch_assoc($result)) {
if (!$row['gamertag']=='')  {
echo "<tr><td>" . $row['uname'];
echo "<td><a href='http://profile.mygamercard.net/" . $row['gamertag']; 
echo "' targer='mainFrame'>" . $row['gamertag'] . "</a>";
                                } else {
echo "<tr><td>" . $row['uname'];
echo "<td>No Gamertag Available";
                                       }
echo "</form>";
                                        }
echo "</table></center>";
                          }
                         

// *************MAIN CODE************
chooseGamertag();                 
exit;
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.