Forum Moderators: coopster
Parse error: parse error, unexpected T_STRING in /www/g/gwecaasu2006/htdocs/getRegistration.php on line 24
in the following code:
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
can anybody let me know what i'm doing wrong?
thanks!
can't see any error here, in the piece of code you have posted
but you might want to do this:
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "\t<tr>\n";
foreach ($line as $col_value)
{
echo "\t\t<td>".$col_value."</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
hope it helps
<?
/* declare some relevant variables */
$DBhost = "mysql16.powweb.com";
$DBuser = "****";
$DBpass = "****";
$DBName = "gwregistration";
$table = "registration";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery = "SELECT * FROM $table;
$result = mysql_query($sqlquery);
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "\t<tr>\n";
foreach ($line as $col_value)
{
echo "\t\t<td>".$col_value."</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
if(mysql_num_rows($result)<1){
echo "<font face=Arial size=+0><b>No
Results!</b></font><br>";
}
mysql_free_result($result);
?>
</body></html>
i've been looking it over and over and can't find anything. i'm fairly new to php, but this was basically copied over from a tutorial and i can't seem to see where the error is. the current error i'm getting now is:
Parse error: parse error, unexpected '>' in /www/g/gwecaasu2006/htdocs/getRegistration.php on line 23
thanks again!