0

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

<?php
$page_title="View Users";
include("header.html");
include("nav.html");
?>
<div id="content">
<?php
$num=
require_once("connect.php");
$q="SELECT first_name, last_name, user_id FROM users";
$r=mysql_query($q,$dbc);
$num=mysql_num_rows($r);
echo "<center>Total no. of users registered : ".$num."<br /><br /></center>";
if($r)
{
	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>
		 </tr>';
		 while($row=mysql_fetch_array($r,MYSQL_ASSOC))
		 {
			 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>'.
			 '</tr>';
		 }
	echo '</table>';
}
mysql_free_result($r);			 
?>
</div>
<?php
include("footer.html");
?>
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by karthik_ppts
0

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.

Attachments screenshot.png 32.97 KB
0

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.

Edited by karthik_ppts: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.