Hi - I've got a small :rolleyes: problem with a script I've written. Nothing comes from the variables so I get no results... any ideas?
<?php
include("includes/confstring.php");
$studentfind = mysql_query("SELECT fname,lname,email,courseid,chapter FROM student")
or die(mysql_error());
While($row = mysql_fetch_array($studentfind))
{
$x = 1;
$fname.$x = $row['fname'];
$lname.$x = $row['lname'];
$email.$x = $row['email'];
$courseid.$x = $row['courseid'];
$chapter.$x = $row['chapter'];
$retrievetest = mysql_query("SELECT test FROM test WHERE courseid='$courseid.$x' AND chapter='$chapter.$x'")
or die(mysql_error());
While($roger = mysql_fetch_array($retrievetest))
{
echo 'Added the following test to email for $fname$x $lname$x:';
echo $roger['test'];
}
mysql_free_result($retrievetest);
$x++;
}
mysql_free_result($studentfind);
?>
It appears to be this bit that is the problem:
$x = 1;
$fname.$x = $row['fname'];
$lname.$x = $row['lname'];
$email.$x = $row['email'];
$courseid.$x = $row['courseid'];
$chapter.$x = $row['chapter'];
Since I have an $x there it appears to be replacing the $fname with $x.. but I really needed to have $fname called $fname1 ... $fname2 etc which is why I added .$x on the end.... I'm using the incorrect syntax, any help would be appreciated.
Chris