Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda