Nibinaear
February 10th, 2005, 05:31 AM
For some reason I can't get the database contents to output to the screen in each of these while loops. If the loop is placed just after the $query variable, it works, but placed seperately in different <? ?> tags it just can't seem to see the variables, does this have something to do with the scope of the variables? I've tried using global $query, $input, but that doesn't help.
<?
include 'imp/odbc_connection.php';
$input = "SELECT DISTINCT * FROM assignment.assessments";
$query = odbc_exec($odbc,$input);
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table bgcolor = "#009999" width: "70%" height= "70%">
<tr>
<td valign = "top" align = "left">
<form name = "form1"><br/>
<!--Module Box-->
Module:
<select name = "module">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Module']."";
}
?>
"></option>
</select>
<br/>
<!--Assessment Type-->
Assessment Type:
<select name = "type">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Type']."";
}
?>
"></option>
</select>
<br/>
<!--Semester, 1 or 2?-->
Semester:
<!--50-->
<select name = "semester">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Semester']."";
}
?>
"></option>
</select>
<br/>
<!--Percentage Mark-->
Percentage Mark Requirement:
<select name = "percentage">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Percentage mark']."";
}
?>
"></option>
</select>
<br/>
<!--Date Due-->
Date Due:
<select name = "date">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Date Due']."";
}
?>
"></option>
</select>
<br/>
<!--Preperation Time-->
Preparation Time:
<select name = "prep">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Preperation time']."";
}
?>
"></option>
</select>
<br/>
</form>
</td>
</tr>
</table>
</body>
</html>
<?
include 'imp/odbc_connection.php';
$input = "SELECT DISTINCT * FROM assignment.assessments";
$query = odbc_exec($odbc,$input);
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table bgcolor = "#009999" width: "70%" height= "70%">
<tr>
<td valign = "top" align = "left">
<form name = "form1"><br/>
<!--Module Box-->
Module:
<select name = "module">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Module']."";
}
?>
"></option>
</select>
<br/>
<!--Assessment Type-->
Assessment Type:
<select name = "type">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Type']."";
}
?>
"></option>
</select>
<br/>
<!--Semester, 1 or 2?-->
Semester:
<!--50-->
<select name = "semester">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Semester']."";
}
?>
"></option>
</select>
<br/>
<!--Percentage Mark-->
Percentage Mark Requirement:
<select name = "percentage">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Percentage mark']."";
}
?>
"></option>
</select>
<br/>
<!--Date Due-->
Date Due:
<select name = "date">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Date Due']."";
}
?>
"></option>
</select>
<br/>
<!--Preperation Time-->
Preparation Time:
<select name = "prep">
<option value = "
<?
while($record = odbc_fetch_array($query))
{
echo "".$record['Preperation time']."";
}
?>
"></option>
</select>
<br/>
</form>
</td>
</tr>
</table>
</body>
</html>