I am currently phping a site to test people on latin (not that this really matters!). I have programmed it so far so that words are stored in a mysql database and that a function test() displays a(depending on it’s id, starting at 1) latin word with a question mark next to a field. If you type in the correct english word (the translation) then it echos ’ RIGHT!’ and ‘WRONG!’ if not. The problem is I cannot work out how to move it onto the next word in the database. It needs a loop of some kind, I have tried and failed though:
This is the index page:
[code]<? include('header.php'); ?>
<input type="text" name="eng" size="40" class="field" value="" |
This is the function (test)(in header.php):
[code]<?
include “config.php”;
function test($r)
{
include(‘config.php’);
$sql = “SELECT * FROM tb_vb1 WHERE id=’$r’”;
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$lat = $row[“lat”];
mysql_close($con);
echo “What is the English for $lat?”;
include(‘config.php’);
$sql = "SELECT * FROM tb_vb1 WHERE id='$r'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$eng = $row["eng"];
mysql_close($con);
global $alex;
if ($_POST[‘eng’] == $eng)
{
$alex = true;
}
else
{
$alex = false;
}
return;
}
?>[/code]
Thank you, you can actually find the site if you go here: http://www.teapay.com if you want to see what I mean!