slj90 Posted December 11, 2009 Share Posted December 11, 2009 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 More sharing options...
rajivgonsalves Posted December 11, 2009 Share Posted December 11, 2009 print “</tr>" ?? should be print "</tr>" Link to comment https://forums.phpfreaks.com/topic/184735-hyperlink-in-code/#findComment-975225 Share on other sites More sharing options...
oni-kun Posted December 11, 2009 Share Posted December 11, 2009 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 More sharing options...
slj90 Posted December 11, 2009 Author Share Posted December 11, 2009 Thanks guys Link to comment https://forums.phpfreaks.com/topic/184735-hyperlink-in-code/#findComment-975227 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.