Jump to content

Warning: Undefined array key, the query mysql is working well, is a php problem


bertrc
 Share

Go to solution Solved by Barand,

Recommended Posts

Warning: Undefined array key "chocolate.id_chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php on line 17

Warning: Undefined array key "chocolate.name_chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php  on line 17

Warning: Undefined array key "type_chocolate.id_type_chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php  on line 17

Warning: Undefined array key "chocolate_chocolate.type__chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php on line 17
Warning: Undefined array key "type__chocolate.id_chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php  on line 17

<?php

ini_set('display_errors', 1);

ini_set('display_startup_errors', 1);

error_reporting(E_ALL);





mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

$mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cocoa");



$query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'";

$result = mysqli_query($mysqli, $query);



/* numeric array */

while ($row = mysqli_fetch_array($result, MYSQLI_BOTH))

{

printf("%s %s %s %s %s\n", $row["chocolate.id_chocolate"], $row["chocolate.name_chocolate"], $row["type_chocolate.id_type_chocolate"],$row["type_chocolate.type_chocolate"],$row["type_chocolate.id_chocolate"]);?> <br>

<?php

}

?>

 

Link to comment
Share on other sites

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.

 Share

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