Jump to content

Parse Error: Unexpected T_STRING


vccowner

Recommended Posts

Hello, I am a newbie to PHP Hand Coding.  I am using the book "Beginning PHP, Apache, MySQL Web Development."  I copy their code syntax to the letter, but I still get an error even though the structure of code looks exactly like it is in the book.  Maybe I'm just not seeing it:

 

The full error message is:

 

Parse error: parse error, unexpected T_STRING, expecting '(' in C:\Program Files\xampp\htdocs\webapps\testapp\DisplayTeamMembers.php on line 30

 

line 30 refers to: for each ($rows as $value) {

 

I need a pair of "fresh eyes" to see what I obviously am having a difficult time seeing for myself.

 

Thanks in advance.

 

 

The code is as follows:

 

<?php require_once('../Connections/DevEnvironment.php'); ?>

<?php

mysql_select_db($database_DevEnvironment, $DevEnvironment);

$query_ActiveTeamMembers = "SELECT displayname, role, homephone, cellphone, emailaddress FROM mstrteammembers WHERE activestatus = 1 ORDER BY displayname ASC";

$ActiveTeamMembers = mysql_query($query_ActiveTeamMembers, $DevEnvironment)

or die(mysql_error());

$row_ActiveTeamMembers = mysql_fetch_assoc($ActiveTeamMembers);

$totalRows_ActiveTeamMembers = mysql_num_rows($ActiveTeamMembers);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Team Directory</title>

</head>

<body>

<p> </p>

<table width= 98% border=0 cellspacing=5 cellpadding=5>

<THEAD>

<TR>

<TH>Team Member</TH>

<TH>Role</TH>

<TH>Home Phone</TH>

<TH>Cell Phone</TH>

<TH>Email</TH>

</TR>

</THEAD>

<?php

    while ($rows=mysql_fetch_assoc($ActiveTeamMembers)) {

echo"<tr>\n";

for each ($rows as $value) {

echo "<td>\n";

echo $value;

echo "</td>\n";

}

echo "</tr><br>\n";

}

?>

</table>

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/48048-parse-error-unexpected-t_string/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.