I wrote this code and when I run the page I get the parse error :-

Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\view.php on line 30

my code is :-

i checked my whole code, i was unable to find the error

$page_title="View Users";
<div id="content">
$q="SELECT first_name, last_name, user_id FROM users";
echo "<center>Total no. of users registered : ".$num."<br /><br /></center>";
	echo '<table align="center" border="2" cellspacing="3" cellpadding="3" width="100%">
	     <tr><td align="left"><b>Edit</b></td>
		 <td align="left"><b>Delete</b></td>
		 <td align="left"><b>ID</b></td>
		 <td align="left"><b>First Name</b></td>
		 <td align="Left"><b>Last Name</b></td>
			 echo '<tr> 
			 <td align="center"><a href="edit.php?id="'.$row['user_id'].'>Edit</a></td>'.
			 '<td align="center"><a href="delete.php?id="'.$row['user_id'].'Delete</a></td>'.
			 '<td align="center">'.$row['user_id'].'</td>'.
			 '<td align="left">'.$row['first_name'].'</td>'.
			 '<td align="center">'.$row.['last_name'].'</td>'.
	echo '</table>';

I fixed the error, but now I am having a different problem now. When I go on the generated page's edit and delete link, i get a link but i should display the link like edit.php?id=$id and delete.php?id=$id but instead it's displaying like edit.php?id= and delete.php$id= and not displaying the generated id in the URL. I have also attached a screen shot.

You have missed the close '>' of <a> tag in line 27

'<td align="center"><a href="delete.php?id="'.$row['user_id'].' > Delete</a></td>'.

mark this thread as unsolved or start a new thread. Then only it visible to lot of users.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.