theThe 'Do' method is for prepared statementstatements and it returns (by fetchall()), i. I am also using two statement which is looping, is statements. Is there any better code (Sql) where i canway to fetch two tabletables in one statement or query? if no then If not, what can iI do to makeimprove this code look better. (PHP)?
// 'id' is index in 'userinfo' table and 'id' in 'election' table is a child index(foreign key)
// 'ElectionId' is also the index, but it is not connected with othertable (only 'id' is linked)
<?php
$call = new world();
$get = $call->Do("SELECT Votes, Views, id FROM election WHERE ElectionId = ?", array("electionIdUknwn"));
foreach($get as $show)
{
<div>"Votes is :".$show[0]</div>
$add = $call->Do("SELECT username FROM userinfo WHERE id = ?", array($show[2]) );
foreach($add as $display)
{
<div>"Username is :".$display[0]</div>
}
<div>"Views are :".$show[1]</div>
}
?>