- Edited
to get various parameter without repeat with the function str_repeat
I get various parameter but the while print all of them
Warning: Undefined variable $row in /var/www/html/cocoa/index.php on line 11
Warning: Trying to access array offset on value of type null in /var/www/html/cocoa/index.php on line 11
Deprecated: str_repeat(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/cocoa/index.php on line 11
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cocoa");
$query = "SELECT type_chocolate.type_chocolate,type_chocolate.type_chocolate
FROM type_chocolate";
$result = mysqli_query($mysqli, $query);
/* numeric array */
if(str_repeat($row["type_chocolate"], 1))
{
while ($row = mysqli_fetch_array($result, MYSQLI_BOTH))
{
printf("%s %s\n","<a href='cocoa_type_chocolate.php?type_chocolate=" .
$row["type_chocolate"] . "'>" , ucfirst($row["type_chocolate"]) . "</a>");?> <br>
<?php
}
}
?>