// snag the query string
$qs=$_SERVER["QUERY_STRING"];
if(!$qs){$qs = 1;}
// grab config.php - database parameters
include("config.php");
// open database connection
$connection = mysqli_connect($server, $user, $pass, $database);
// generate and execute query
$query = "SELECT * FROM kanji WHERE cardno = $qs";
$result = mysqli_query($connection, $query);
// if records present
if (mysqli_num_rows($result) > 0)
{
// iterate through resultset
while($row = mysqli_fetch_object($result))
{
?>
echo $row->chtr; ?>
| Radical/Stroke | echo $row->radical; ?>/ echo $row->stroke; ?> |
| On Reading | echo $row->onreading; ?> |
| Kun Reading | echo $row->kunreading; ?> |
| Meaning | echo $row->meaning1; ?> |
if ($row->reading3 != null){ ?>
Additional Reading | Meaning |
echo $row->reading3; ?> | echo $row->meaning3; ?> |
} ?>
if ($row->reading4 != null){ ?>
Additional Reading | Meaning |
echo $row->reading4; ?> | echo $row->meaning4; ?> |
} ?>
if ($row->reading5 != null){ ?>
Additional Reading | Meaning |
echo $row->reading5; ?> | echo $row->meaning5; ?> |
} ?>
if ($row->reading6 != null){ ?>
Additional Reading | Meaning |
echo $row->reading6; ?> | echo $row->meaning6; ?> |
} ?>
| Strokes | echo $row->numstrokes; ?> |
if ($row->category2 != null){ ?>
| Categories | echo $row->category; ?>, echo $row->category2; ?>
if ($row->category3 != null){ ?>
, echo $row->category3; ?>
} ?>
if ($row->category4 != null){ ?>
, echo $row->category4; ?>
} ?>
|
} else {?>
| Category | echo $row->category; ?> |
} ?>
if ($row->notes != null){ ?>
| Notes | echo $row->notes; ?> |
} ?>
if ($row->other != null){ ?>
| Other | echo $row->other; ?> |
} ?>
$nextcard = $qs + 1;
$prevcard = $qs - 1;
if ($prevcard < 1){$prevcard = 1;}
?>
}
}
// if no records present - display message
else
{ echo "
Oops, no card found.
"; }
?>