Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
php functions and mysqli
<?php
select1($conn); 
function select2 ($conn,$id ,$name)
{   
    $stmt = $conn->prepare("SELECT def FROM define WHERE wordkey = ?");
    mysqli_stmt_bind_param($stmt, 'i', $id);
    $stmt->execute(); 
    $stmt->bind_result($def);
    while($stmt->fetch()) {
        echo "here"; // for testing
        $wordArray += $def; 
        //I will make a call to the js function here sending id, name and wordArray
    }  
    //$stmt->close();
}

function select1 ($conn){
    $stmt2 = $conn->prepare("SELECT id , name FROM words");
    $stmt2->execute(); 
    $stmt2->bind_result($id, $name);
    while($stmt2->fetch()) {
        select2 ($conn,$id ,$name);
    }
}
?>

I want to ask question I have words table and def table. in def table i have multiple definitions for the same words.id. Is it possible to select them in one query statement ?

words table have

id , name 

def table have

id, wordkey , definition

I want to retrieve name and for each name select all its definitions so that I will then call a javascript function (id, name, defArray) to display each name with the array of its definitions. I thought of doing it through 2 select statement, but the problem is the select2 function is not working. Please Help!

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda