0

Ok I have a promblem. Im getting a unidentified variable error from $found:

Whats wrong here?

while($row = mysql_fetch_array($result))
{
    **$found** = true;
    echo "Character/Alias: " . $row["CharName"] . "<br>Created: " . $row["CharBorn"] . "<br>Game: ";
    if ($row["CharGame"] == '0')
    {
        echo "None";
    }
    else
    {
        echo "In-Game";
    }
}
if(!$found)
{
    echo "No Characters/Aliases<br>";
    echo "<a href='create.php'>Create A Character/Alias</a>";
}
3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by da(code)da
1

Hello,
Just declare $found variable above while loop..as currently if records not found in Query..you are geting error.

use below code:

<?php

**$found=false;**
while($row = mysql_fetch_array($result))
{
    $found = true;
    echo "Character/Alias: " . $row["CharName"] . "<br>Created: " . $row["CharBorn"] . "<br>Game: ";
    if ($row["CharGame"] == '0')
    {
        echo "None";
    }
    else
    {
        echo "In-Game";
    }
}
if(!$found)
{
    echo "No Characters/Aliases<br>";
    echo "<a href='create.php'>Create A Character/Alias</a>";
}

?>
This question has already been answered. 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.