hi all..
I am new at PHP so please bare with me.. and i am pretty sure there is a simple solution to this but through tutorials and books i could not find what i am looking for
here is some what of my code:
$query = 'select * from product where productid = 2'
$db = conn();
$result = $db->query($query);
if (DB::isError($result)){
//error code
exit;
}
if ($result->numRows() < 1){
//error code
exit;
}
i understand i would be doing something like
for ($i=0;$i < $result->numRows();$i++){
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
}
to get the output of the whole thing..
but what i want to do is before the for loop i would like to get a column value of the table..
basically i want to know if is.. if i know there is only and only one row in the table.. i want to get the result out do i still need to go through the for loop to get the data
or can i just use $result to get data fast without putting it into an array and stuff and using for loops
basically how to display output of a row without using for loops
thanx in advance