RE: [PHP] database value count retrieval

2002-08-19 Thread David Freeman
> >SELECT COUNT(x) FROM table; > > > >Make 'x' equal to any column name in the table and add WHERE to the > >clause as needed. > > err...all very well, but how do i retrieve the > value afterwards? > $sqlcom="select count(codigo) from comments where > codigo=$id";

RE: [PHP] database value count retrieval

2002-08-19 Thread Martin Towell
try this: -> $sqlcom="select count(codigo) as cnt from comments where codigo=$id"; $resultadocom = mysql_db_query ("database",$sqlcom); $registocom = mysql_fetch_array($resultadocom); -> $contador = $registocom["cnt"]; print("comentarios= $contador"); the lines marked with -> are t