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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.