Jump to content

Retrieving ID numbers to separate variables


Lucky2710

Recommended Posts

I have a mySQL Database named sports with a table in it named users.

Im trying to retrieve each of my users id #s into separate variables to be used later in my code.

 

Heres my code that gets the id #s together...

 

$sql="SELECT  id FROM users WHERE approved=1";

    $result=mysql_query($sql);

 

  while($row = mysql_fetch_object($result))

  {

    echo $row->id;

echo '<br />';

    mysql_data_seek($result,'$i++');

    $row = mysql_fetch_object($result);

    echo $row->id;

echo '<br />';

  }

 

 

This gets the ids and prints them on my web page but i need to somehow get them as separate variables.

 

Any help would be appreciated.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.