I have table named ipcam (camera id,camera name,camera model,IP address, Url, Port).
I am successfully able to retrieve data from MySQL db.
Now what i intend to do is add an extra field to table at the end called Delete – which is hyperlink and deletes the row by sending id to deletecam.php page here is the code:
<?php
$result = mysql_query("SELECT * from ipcam WHERE user_id = {$user_id}");
echo"<table border=5 colspan=6> <tr><th>IP CAMERA ID </th><th>IP CAMERA NAME </th><th>CAMERA MODEL </th> <th>IP ADDRESS </th> <th>URL </th> <th>PORT </th><th>DELETE </th></tr>";
while($row = mysql_fetch_array($result)){
echo "<tr>
<td>" . $row['id'] . "</td>
<td>" . $row['name'] . "</td>
<td>" . $row['model'] . "</td>
<td>" . $row['ipaddress'] . "</td>
<td>" . $row['url'] . "</td>
<td>" . $row['port'] . "</td>
<td> echo"<html><h3>"; <a href="/deletecam.php?id= <?php echo urlencode($row['id']); ?> "> Delete </a> echo"</h3></html>"; </td></tr>";
}
echo "</table>";
?>
However I am having strange problem when I run this code the error is:
Parse error: syntax error, unexpected '>' in C:\xampp\htdocs\IPCAM\cameralist.php on line 176
the error comes for delete when i try to include the hyperlink in the code.
Am i doing something wrong with syntax or its not possible to do such thing.
Change it to:
You shouldn’t have
<html>inside the table. And you can’t use<?phpinside echoed strings.