0

Currently i have encountered a problem is that when i displaying a result from mysql with a table , it keep showing SYNTAX error "

syntax error, unexpected 'checkbox' (T_STRING), expecting ',' or ';' "

When i remove the second line (checkbox) the problem solved

echo" <tr>
    <td><input type="checkbox" name="userID[]" value="{$row['userID']}" ></td>
    <td>{$row['username']}</td>
    <td>{$row['password']}</td>
    <td>{$row['email']}</td>
    <td>{$row['address']}</td>
 </tr>";

Should be have a checkbox every result that display on the php

Masivuye Cokile
  • 4,754
  • 3
  • 19
  • 34

1 Answers1

1

This is because your string is not formatted properly, you should escape the double quotes as answered by Ben. Ayoub or you can form your string properly as:

echo"<tr>
    <td><input type='checkbox' name='userID[]' value='" . $row['userID'] . "'></td>
    <td>{$row['username']}</td>
    <td>{$row['password']}</td>
    <td>{$row['email']}</td>
    <td>{$row['address']}</td>
 </tr>";
Rohit Ghotkar
  • 803
  • 5
  • 17