vpendse
04-25-2006, 01:21 AM
Hi there, this is a pretty simple thing to do but I'm pretty inexperienced with coding in general. What I want is for this loop to run through my db and get every result from the "username" column. This is my code:
mysql_connect(localhost,$db_username,$db_password);
@mysql_select_db($db_database) or die( "Unable to select database");
$query="SELECT username FROM userdb";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num)
{
$user=mysql_result($result,$i,"username");
dbreader($user);
$i++;
}
So yeah, I just want it to get the content of the first field in "username" column, then run dbreader($user); , then move to the next record in the username column, until there are no more left.
For some reason it's only doing the first one.
mysql_connect(localhost,$db_username,$db_password);
@mysql_select_db($db_database) or die( "Unable to select database");
$query="SELECT username FROM userdb";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num)
{
$user=mysql_result($result,$i,"username");
dbreader($user);
$i++;
}
So yeah, I just want it to get the content of the first field in "username" column, then run dbreader($user); , then move to the next record in the username column, until there are no more left.
For some reason it's only doing the first one.