Echo inner join to $rowHow are echo and print different in PHP?Php SQL query check (count ?) if they are listings depending of cities, states and countriesselecting/view one row from listPHP script and MYSQL query return different (and undesirable) dataINNER JOIN results in no rowsUsing jquery to get .html() of elements in php table where mysql rows are “echoed” - only getting elements off first tableinner join and echo solutionInner Join for Multiple RowDeleting a row with inner joinHow to echo INNER Join in PHP

Increase performance creating Mandelbrot set in python

How easy is it to start Magic from scratch?

What is the intuitive meaning of having a linear relationship between the logs of two variables?

How does buying out courses with grant money work?

Is HostGator storing my password in plaintext?

Proof of work - lottery approach

Large drywall patch supports

Go Pregnant or Go Home

Inappropriate reference requests from Journal reviewers

Why, precisely, is argon used in neutrino experiments?

Two monoidal structures and copowering

How does the UK government determine the size of a mandate?

Why escape if the_content isnt?

How to safely derail a train during transit?

Failed to fetch jessie backports repository

How do I rename a Linux host without needing to reboot for the rename to take effect?

What can we do to stop prior company from asking us questions?

Different result between scanning in Epson's "color negative film" mode and scanning in positive -> invert curve in post?

Method to test if a number is a perfect power?

Sequence of Tenses: Translating the subjunctive

Is this apparent Class Action settlement a spam message?

What is the difference between "behavior" and "behaviour"?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Arithmetic mean geometric mean inequality unclear



Echo inner join to $row


How are echo and print different in PHP?Php SQL query check (count ?) if they are listings depending of cities, states and countriesselecting/view one row from listPHP script and MYSQL query return different (and undesirable) dataINNER JOIN results in no rowsUsing jquery to get .html() of elements in php table where mysql rows are “echoed” - only getting elements off first tableinner join and echo solutionInner Join for Multiple RowDeleting a row with inner joinHow to echo INNER Join in PHP













-1















Hello I've this query to populate table from database.



$sql = "SELECT * FROM clientes";
if($result = mysqli_query($link, $sql))
if(mysqli_num_rows($result) > 0)
echo "<table class='table table-bordered table-striped'>";
echo "<thead>";
echo "<tr>";
echo "<th>#</th>";
echo "<th>Grupo</th>";
echo "<th>Grupo</th>";
echo "<th>Ação</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_array($result))
echo "<tr>";
echo "<td>" . $row['id_cliente'] . "</td>";
echo "<td>" . $row['id_grupo'] . "</td>";
echo "<td>" . $row['cliente'] . "</td>";
echo "<td>";
echo "<a href='read.php?id=". $row['id_cliente'] ."' title='Ver Registo' data-toggle='tooltip'><span class='mdi mdi-magnify'></span></a>";
echo "<a href='update.php?id=". $row['id_cliente'] ."' title='Actualizar Registo' data-toggle='tooltip'><span class='mdi mdi-pencil'></span></a>";
echo "<a href='delete.php?id=". $row['id_cliente'] ."' title='Apagar Registo' data-toggle='tooltip'><span class='mdi mdi-sync'></span></a>";
echo "</td>";
echo "</tr>";

echo "</tbody>";
echo "</table>";
// Free result set
mysqli_free_result($result);
else
echo "<p class='lead'><em>Sem registos</em></p>";

else
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);


// Close connection
mysqli_close($link);
?>


The values in the echo $row['id_grupo'] are numeric but related to another table.



I know the query to run inside the php myadmin in order to inner join values from two tables:



SELECT grupos.grupo 
FROM clientes
INNER JOIN grupos
ON clientes.id_grupo = grupos.id_grupo


How do I echo this on the $row['id_grupo'] ??










share|improve this question

















  • 1





    Change your SQL statement in your PHP to be you example one, but in the SELECT, you can probably use SELECT clientes.*, groupos.grupo, then access it in PHP with $row['grupo'].

    – Jonnix
    Mar 8 at 11:34












  • What about use the stack overflow in Portuguese? pt.stackoverflow.com

    – Fellipe Sanches
    Mar 8 at 11:37















-1















Hello I've this query to populate table from database.



$sql = "SELECT * FROM clientes";
if($result = mysqli_query($link, $sql))
if(mysqli_num_rows($result) > 0)
echo "<table class='table table-bordered table-striped'>";
echo "<thead>";
echo "<tr>";
echo "<th>#</th>";
echo "<th>Grupo</th>";
echo "<th>Grupo</th>";
echo "<th>Ação</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_array($result))
echo "<tr>";
echo "<td>" . $row['id_cliente'] . "</td>";
echo "<td>" . $row['id_grupo'] . "</td>";
echo "<td>" . $row['cliente'] . "</td>";
echo "<td>";
echo "<a href='read.php?id=". $row['id_cliente'] ."' title='Ver Registo' data-toggle='tooltip'><span class='mdi mdi-magnify'></span></a>";
echo "<a href='update.php?id=". $row['id_cliente'] ."' title='Actualizar Registo' data-toggle='tooltip'><span class='mdi mdi-pencil'></span></a>";
echo "<a href='delete.php?id=". $row['id_cliente'] ."' title='Apagar Registo' data-toggle='tooltip'><span class='mdi mdi-sync'></span></a>";
echo "</td>";
echo "</tr>";

echo "</tbody>";
echo "</table>";
// Free result set
mysqli_free_result($result);
else
echo "<p class='lead'><em>Sem registos</em></p>";

else
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);


// Close connection
mysqli_close($link);
?>


The values in the echo $row['id_grupo'] are numeric but related to another table.



I know the query to run inside the php myadmin in order to inner join values from two tables:



SELECT grupos.grupo 
FROM clientes
INNER JOIN grupos
ON clientes.id_grupo = grupos.id_grupo


How do I echo this on the $row['id_grupo'] ??










share|improve this question

















  • 1





    Change your SQL statement in your PHP to be you example one, but in the SELECT, you can probably use SELECT clientes.*, groupos.grupo, then access it in PHP with $row['grupo'].

    – Jonnix
    Mar 8 at 11:34












  • What about use the stack overflow in Portuguese? pt.stackoverflow.com

    – Fellipe Sanches
    Mar 8 at 11:37













-1












-1








-1








Hello I've this query to populate table from database.



$sql = "SELECT * FROM clientes";
if($result = mysqli_query($link, $sql))
if(mysqli_num_rows($result) > 0)
echo "<table class='table table-bordered table-striped'>";
echo "<thead>";
echo "<tr>";
echo "<th>#</th>";
echo "<th>Grupo</th>";
echo "<th>Grupo</th>";
echo "<th>Ação</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_array($result))
echo "<tr>";
echo "<td>" . $row['id_cliente'] . "</td>";
echo "<td>" . $row['id_grupo'] . "</td>";
echo "<td>" . $row['cliente'] . "</td>";
echo "<td>";
echo "<a href='read.php?id=". $row['id_cliente'] ."' title='Ver Registo' data-toggle='tooltip'><span class='mdi mdi-magnify'></span></a>";
echo "<a href='update.php?id=". $row['id_cliente'] ."' title='Actualizar Registo' data-toggle='tooltip'><span class='mdi mdi-pencil'></span></a>";
echo "<a href='delete.php?id=". $row['id_cliente'] ."' title='Apagar Registo' data-toggle='tooltip'><span class='mdi mdi-sync'></span></a>";
echo "</td>";
echo "</tr>";

echo "</tbody>";
echo "</table>";
// Free result set
mysqli_free_result($result);
else
echo "<p class='lead'><em>Sem registos</em></p>";

else
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);


// Close connection
mysqli_close($link);
?>


The values in the echo $row['id_grupo'] are numeric but related to another table.



I know the query to run inside the php myadmin in order to inner join values from two tables:



SELECT grupos.grupo 
FROM clientes
INNER JOIN grupos
ON clientes.id_grupo = grupos.id_grupo


How do I echo this on the $row['id_grupo'] ??










share|improve this question














Hello I've this query to populate table from database.



$sql = "SELECT * FROM clientes";
if($result = mysqli_query($link, $sql))
if(mysqli_num_rows($result) > 0)
echo "<table class='table table-bordered table-striped'>";
echo "<thead>";
echo "<tr>";
echo "<th>#</th>";
echo "<th>Grupo</th>";
echo "<th>Grupo</th>";
echo "<th>Ação</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_array($result))
echo "<tr>";
echo "<td>" . $row['id_cliente'] . "</td>";
echo "<td>" . $row['id_grupo'] . "</td>";
echo "<td>" . $row['cliente'] . "</td>";
echo "<td>";
echo "<a href='read.php?id=". $row['id_cliente'] ."' title='Ver Registo' data-toggle='tooltip'><span class='mdi mdi-magnify'></span></a>";
echo "<a href='update.php?id=". $row['id_cliente'] ."' title='Actualizar Registo' data-toggle='tooltip'><span class='mdi mdi-pencil'></span></a>";
echo "<a href='delete.php?id=". $row['id_cliente'] ."' title='Apagar Registo' data-toggle='tooltip'><span class='mdi mdi-sync'></span></a>";
echo "</td>";
echo "</tr>";

echo "</tbody>";
echo "</table>";
// Free result set
mysqli_free_result($result);
else
echo "<p class='lead'><em>Sem registos</em></p>";

else
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);


// Close connection
mysqli_close($link);
?>


The values in the echo $row['id_grupo'] are numeric but related to another table.



I know the query to run inside the php myadmin in order to inner join values from two tables:



SELECT grupos.grupo 
FROM clientes
INNER JOIN grupos
ON clientes.id_grupo = grupos.id_grupo


How do I echo this on the $row['id_grupo'] ??







php






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 11:29









xela05xela05

33




33







  • 1





    Change your SQL statement in your PHP to be you example one, but in the SELECT, you can probably use SELECT clientes.*, groupos.grupo, then access it in PHP with $row['grupo'].

    – Jonnix
    Mar 8 at 11:34












  • What about use the stack overflow in Portuguese? pt.stackoverflow.com

    – Fellipe Sanches
    Mar 8 at 11:37












  • 1





    Change your SQL statement in your PHP to be you example one, but in the SELECT, you can probably use SELECT clientes.*, groupos.grupo, then access it in PHP with $row['grupo'].

    – Jonnix
    Mar 8 at 11:34












  • What about use the stack overflow in Portuguese? pt.stackoverflow.com

    – Fellipe Sanches
    Mar 8 at 11:37







1




1





Change your SQL statement in your PHP to be you example one, but in the SELECT, you can probably use SELECT clientes.*, groupos.grupo, then access it in PHP with $row['grupo'].

– Jonnix
Mar 8 at 11:34






Change your SQL statement in your PHP to be you example one, but in the SELECT, you can probably use SELECT clientes.*, groupos.grupo, then access it in PHP with $row['grupo'].

– Jonnix
Mar 8 at 11:34














What about use the stack overflow in Portuguese? pt.stackoverflow.com

– Fellipe Sanches
Mar 8 at 11:37





What about use the stack overflow in Portuguese? pt.stackoverflow.com

– Fellipe Sanches
Mar 8 at 11:37












2 Answers
2






active

oldest

votes


















0














Using:



SELECT clientes.*, grupos.grupo 
FROM clientes
INNER JOIN grupos
ON clientes.id_grupo = grupos.id_grupo


Instead SELECT * FROM clientes



And you have the value $row['grupo'] in the while






share|improve this answer























  • Thank you it worked! I was using similar but making the wrong SELECT...

    – xela05
    Mar 8 at 12:05


















1














You can use Alias here for column name something like:



SELECT clientes.id_grupo as c_group, grupos.id_grupo as g_group
// rest of your query.


then you can get these columns in $row as:



$row['c_group'] // value from clientes table
$row['g_group'] // value from groups table


Side Note:
MySQL ALIASES can be used to create a temporary name for columns or tables.



Useful link






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55062340%2fecho-inner-join-to-row%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Using:



    SELECT clientes.*, grupos.grupo 
    FROM clientes
    INNER JOIN grupos
    ON clientes.id_grupo = grupos.id_grupo


    Instead SELECT * FROM clientes



    And you have the value $row['grupo'] in the while






    share|improve this answer























    • Thank you it worked! I was using similar but making the wrong SELECT...

      – xela05
      Mar 8 at 12:05















    0














    Using:



    SELECT clientes.*, grupos.grupo 
    FROM clientes
    INNER JOIN grupos
    ON clientes.id_grupo = grupos.id_grupo


    Instead SELECT * FROM clientes



    And you have the value $row['grupo'] in the while






    share|improve this answer























    • Thank you it worked! I was using similar but making the wrong SELECT...

      – xela05
      Mar 8 at 12:05













    0












    0








    0







    Using:



    SELECT clientes.*, grupos.grupo 
    FROM clientes
    INNER JOIN grupos
    ON clientes.id_grupo = grupos.id_grupo


    Instead SELECT * FROM clientes



    And you have the value $row['grupo'] in the while






    share|improve this answer













    Using:



    SELECT clientes.*, grupos.grupo 
    FROM clientes
    INNER JOIN grupos
    ON clientes.id_grupo = grupos.id_grupo


    Instead SELECT * FROM clientes



    And you have the value $row['grupo'] in the while







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 8 at 11:35









    RoyRoy

    2,6731822




    2,6731822












    • Thank you it worked! I was using similar but making the wrong SELECT...

      – xela05
      Mar 8 at 12:05

















    • Thank you it worked! I was using similar but making the wrong SELECT...

      – xela05
      Mar 8 at 12:05
















    Thank you it worked! I was using similar but making the wrong SELECT...

    – xela05
    Mar 8 at 12:05





    Thank you it worked! I was using similar but making the wrong SELECT...

    – xela05
    Mar 8 at 12:05













    1














    You can use Alias here for column name something like:



    SELECT clientes.id_grupo as c_group, grupos.id_grupo as g_group
    // rest of your query.


    then you can get these columns in $row as:



    $row['c_group'] // value from clientes table
    $row['g_group'] // value from groups table


    Side Note:
    MySQL ALIASES can be used to create a temporary name for columns or tables.



    Useful link






    share|improve this answer





























      1














      You can use Alias here for column name something like:



      SELECT clientes.id_grupo as c_group, grupos.id_grupo as g_group
      // rest of your query.


      then you can get these columns in $row as:



      $row['c_group'] // value from clientes table
      $row['g_group'] // value from groups table


      Side Note:
      MySQL ALIASES can be used to create a temporary name for columns or tables.



      Useful link






      share|improve this answer



























        1












        1








        1







        You can use Alias here for column name something like:



        SELECT clientes.id_grupo as c_group, grupos.id_grupo as g_group
        // rest of your query.


        then you can get these columns in $row as:



        $row['c_group'] // value from clientes table
        $row['g_group'] // value from groups table


        Side Note:
        MySQL ALIASES can be used to create a temporary name for columns or tables.



        Useful link






        share|improve this answer















        You can use Alias here for column name something like:



        SELECT clientes.id_grupo as c_group, grupos.id_grupo as g_group
        // rest of your query.


        then you can get these columns in $row as:



        $row['c_group'] // value from clientes table
        $row['g_group'] // value from groups table


        Side Note:
        MySQL ALIASES can be used to create a temporary name for columns or tables.



        Useful link







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 8 at 11:46

























        answered Mar 8 at 11:35









        devprodevpro

        13.8k32135




        13.8k32135



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55062340%2fecho-inner-join-to-row%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived