 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
riccco
Joined: 18 Nov 2007 Posts: 3
|
Posted: Sun Nov 18, 2007 9:57 pm Post subject: MDB2 : PB to get number of result in a select |
|
|
Hello,
i have this code that don't work :
| Code: | ...
$res =& $mdb2->query('SELECT DISTINCT titre * FROM fetched');
$row = $res->fetchRow();
if(empty($row['titre'])){ echo "vide";}else{ echo "plein";}
$mdb2->disconnect();
...
|
and this is the server response :
Call to undefined method MDB2_Error::fetchRow()
Is there somebody that can help me figure out the problem ?
thanks by advance
riccco |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Mon Nov 19, 2007 1:25 am Post subject: |
|
|
$res is an instance of PEAR_Error (which doesn't have a fetchRow() method). It's likely that you're not connected to a database or that your SQL query is wrong.
For debugging (but not for production use, of course):
| Code: |
...
$res =& $mdb2->query('SELECT DISTINCT titre * FROM fetched');
if (MDB2::isError($res)) {
die($res->getMessage . ', ' . $res->getDebugInfo());
}
$row = $res->fetchRow();
...
|
|
|
| Back to top |
|
 |
riccco
Joined: 18 Nov 2007 Posts: 3
|
Posted: Mon Nov 19, 2007 11:46 am Post subject: |
|
|
@Mark:
Thank you very much. I see now that there was an error in my query.
ricco |
|
| Back to top |
|
 |
cfletcher1856
Joined: 23 Nov 2007 Posts: 7
|
Posted: Sat Nov 24, 2007 6:16 pm Post subject: |
|
|
| riccco wrote: | @Mark:
Thank you very much. I see now that there was an error in my query.
ricco |
Were you missing a , after DISTICT titre, * |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|