Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is wrong with this php code? // Table header. echo \'<table align=\"center\

ID: 3572509 • Letter: W

Question

What is wrong with this php code?

// Table header.
echo '<table align="center" cellspacing="3" cellpadding="3" width="75%">
<tr><td align="left"><b>Team</b></td><td align="left"><b>Team_ID</b></td><td align="left"><b>Pennants</b></td><td align="left"><b>World Series</b></td></tr>
';

// Fetch and print all the records:
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
  echo '<td><td align="left">' . $row['team'] . '</td></tr> <tr><td align="left">' . $row['teamid'] . '</tr></td><td align="left">' . $row['pennant'] . '</td></tr>'</td><td align="left">' . $row['world'] . '</td></tr>';

Explanation / Answer

Results:

No issues found in table header

But errors found in the fetch and print all records part

Error: There is 1 more opening curly braces '{' found

This count is unaware if curly braces are inside of a string

PHP Syntax Check: Parse error: syntax error, unexpected '/' in your code on line 5

/ Fetch and print all the records:

PHP Syntax Check: Errors parsing your code

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote