Hello everybody!

My roommate had a problem and asked me for some help. I do not write in Java so I would need some help translating my code from PHP into Java.

Here is the code:

<?php

mysql_connect ( "someserver", "someusername", "somepassword" ) ;
mysql_select_db("somedatabase");

$q = mysql_query ( "SELECT * FROM sektor_c" ) ;

echo "<table style='border: 1px solid'>";
while ( $result = mysql_fetch_object ( $q ) )
{
    echo "<tr>" ;
    $q2 = mysql_query ( "SELECT * FROM sektor_s ss LEFT JOIN merchandise_confired mc ON (ss.id_ss=mc.id_ss AND ids_c=" . $result->ids_c . ")"  ) ;
    while ( $result2 = mysql_fetch_object($q2))
    {
        $confirmed = $confirmed_end = "" ;
        if ( $result2->idm_c !== NULL )
        {
            $confirmed      = "<b>";
            $confirmed_end  = "</b>";
        }
        echo "<td>$confirmed {$result->initial}{$result2->number} $confirmed_end</td>";
    }

    echo "</tr>";
}

echo "</table>";

Thank you for your help!

Please post the code here and its output and add comments to the output explaining what it wrong with it and what it should look like.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.