Código PHP:
sSQL = "SELECT P.*, D.* FROM producto P INNER JOIN detalle_ingreso D ON P.codigo = D.codigo";
try
{
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sSQL);
while(rs.next())
{
cod = rs.getString("codigo");
fac = rs.getString("FacturaProv");
descr = rs.getString("descripcion");
mod = rs.getString("modelo");
mar = rs.getString("marca");
fam = rs.getString("familia");
stk = rs.getString("stock");
prec = rs.getString("precio");
}
}
catch (SQLException ex)
{
JOptionPane.showMessageDialog(null, ex);
}
Código PHP:
sSQL = "SELECT P.*, D.* FROM producto P INNER JOIN detalle_ingreso D ON P.codigo = D.codigo";
try
{
Statement st = cn.createStatement();
boolean results = st.execute(sSQL);
//ResultSet rs = st.executeQuery(sSQL);
int rsCount = 0;
do {
if(results) {
ResultSet rs = st.getResultSet();
rsCount++;
while(rs.next())
{
cod = rs.getString("codigo");
fac = rs.getString("FacturaProv");
descr = rs.getString("descripcion");
mod = rs.getString("modelo");
mar = rs.getString("marca");
fam = rs.getString("familia");
stk = rs.getString("stock");
prec = rs.getString("precio");
}
rs.close();
}
// System.out.println();
results = st.getMoreResults();
} while(results);
st.close();
}
catch (SQLException ex)
{
JOptionPane.showMessageDialog(null, ex);
}