1
I have the following code, but it’s not working and I can’t find the error.
I need to display the 3 lines (123), which you find in $fetch['list_carac']
.
<?php
include 'conect.php';
$sql = "SELECT list_carac FROM select_carac WHERE id_produto = 1";
$exec = $con->query( $sql ) or exit( $con->error );
$fetch = mysqli_fetch_assoc($exec);
$fetch = str_replace( ",", "", $fetch);
echo($fetch['list_carac']);//aqui a saída é 123
foreach($fetch as $value){
$sql = "SELECT nome_carac FROM carac WHERE id_carac = $value";
$exec = $con->query( $sql ) or exit( $con->error );
$row = mysqli_fetch_assoc($exec);
echo $row["nome_carac"];
}
?>
If I take the foreach
and add the id
manually it returns me the record that is in the field nome_carac
. Otherwise no error , but only shows the 1st outputecho($fetch['list_carac']);//aqui a saída é 123
.
If you have some silly syntax error let me know.
– Bacco
Style the Volley of Bebeto in 94, and is Goll !!! Certim patrão vlw ai...
– MagicHat