please help, simple problem (i think)
| From: | Ryan A | Date: | Sat, 07 Jun 2003 18:54:15 +0000 |
| Subject: | please help, simple problem (i think) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-150593@lists.php.net to get a copy of this message | ||
Hi,
Feeling a little braindead, please help.
The below program as you can see is extremly simple,
it connects to the database and runs a select (COUNT) query, this query will
return 5 rows...so far so good, everything is working but I have no idea how
to assign each of the rows to a variable so I can use it...
something like:
$one=$row[1];
$two=$row[2];
$thr=$row[3];
heres the code:
<?php
require "configbwh.php";
$connected=mysql_connect ("$hostt", "$userr", "$passs") or die
('I cannot
connect to the database because: ' . mysql_error());
mysql_select_db ("$db");
$tt = "SELECT ptype, count(*) FROM mylist WHERE ptype IN ('1', '2',
'3',
'4','5') GROUP BY ptype";
if($res= mysql_query($tt))
{
while($row = mysql_fetch_row($res))
{
print($row[1]);
}
}
?>
Cheers,
-Ryan