Forum Moderators: coopster
What I'm trying to do is
if($database_result1 = $database_result2){echo 'SELECTED';}
Here is the class.
class get_sql
{
var $sql;
var $rslt;
# var $_con;
function Sql($sql) {
if($sql!= ""){
$this->rslt = odbtp_query($sql) or die("Could not run $sql query");
$item = array();
while($item = odbtp_fetch_array($this->rslt)){
$this->itms[] = $item;
}
return $this->itms;
odbtp_free_query($this->rslt);
}
}
function CloseCon(){ // Closes the connection to the database
odbtp_close(); # $this->con
return true;
}
}// Class ends
This is how I initiated it.
$bb = new Get_Sql();
$rslts = $bb->Sql($rsBB);
foreach($rslts as $rslt){
HTML form goes here with database results $rslt["Subject"];
Dropdown list with second foreach goes here
}
Any pointers? Thanks
fintan.
<option value="1">id 1</option>
<option value="2" selected>id 2</option>
So id form the first table equals 2 and id form the second table equals 2 so echo selected. That's it.