Jump to content

Hyperlink in code


slj90

Recommended Posts

Hello, I have a code that displays all the entries from my database, this works fine. I am trying to add a link to a Delete button but when I do so it gives me an error (Parse error: syntax error, unexpected '/' in H:\xampp\xampp\htdocs\displayCustomer.php on line 26)

 

The code is as folows:

 

<?php
// (1) Open the database connection – always use localhost
$connection = mysql_connect("localhost", "root");

// (2) Select your  database id
mysql_select_db("customer", $connection);

// (3) Create a query 
   	$query = "SELECT * FROM customer"; 
   
   	// (4) Run the query on the table through the connection 
   	$result = mysql_query ($query); 

  	//Fetch each of the query rows in $result array 
while ($row = mysql_fetch_array($result)) 
{ 
print "<tr>" . 
"<td>" . $row["CustomerID"] . "</td>" . 
"<td>" . $row["Firstnames"] . "</td>" . 
"<td>" . $row["Surname"] . "</td>" . 
"<td>" . $row["Username"] . "</td>" . 
"<td>" . $row["Email"] . "</td>" .
"<td>" . $row["Password"] . "</td><br>" .

//print a change/delete link at the end of each row
"<td><a href=customerChangeDelete.php?id=".$row[CustomerID].">Change/Delete</a></td>";                    print “</tr>"; 

// Then, finish the table
print "</table>";
}
?>

 

However, when I take the '//print a change/delete link at the end of each row' out it works fine.

 

Any ideas?

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/184735-hyperlink-in-code/
Share on other sites

print “</tr>"

??

 

should be

 

print "</tr>"

 

Good catch. code tags are helpful no?

 

But yeah, OP, this is a major reason why coding should only be done in notepad/and IDE. As well as copying code, There's a chance an entity such as a starting quote, which isn't recognized by PHP will happen.

Link to comment
https://forums.phpfreaks.com/topic/184735-hyperlink-in-code/#findComment-975226
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.