- Edited
return one string with one ' in the text. I use this ' is another language is catalan the word is denominació d'origen.
there is a problem with sql and string. the problem is with the concatenation
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'origen'' at line 1 in /var/www/html/cacau/cacau_tipus_xocolata.php:36 Stack trace: #0 /var/www/html/cacau/cacau_tipus_xocolata.php(36): mysqli_query(Object(mysqli), 'SELECT xocolat...') #1 {main} thrown in /var/www/html/cacau/cacau_tipus_xocolata.php on line 36
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cacau");
$query = "SELECT DISTINCT tipus_xocolata.tipus_xocolata,tipus_xocolata.tipus_xocolata
FROM tipus_xocolata";
$result = mysqli_query($mysqli, $query);
/* numeric array */
while ($row = mysqli_fetch_array($result, MYSQLI_BOTH))
{
printf(
'<a href="cacau_tipus_xocolata.php?tipus_xocolata=%s">%s</a><br>\n',
urlencode($row['tipus_xocolata']),
htmlentities(ucfirst($row['tipus_xocolata']))
);
<br>
<?php
}
?>