0

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;
?>

Edited by acdougla17: n/a

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.